What is wrong with my if-statement

@kingsaks, we have a list of community discussions on the same topic here. Maybe you could leverage from the workarounds shared/discussed previously.

Maybe you could have a closer look at this post discussed previously (to have a quick understanding of how the if-statement is used):