Little Question about IF statements

Hey everyone
I just want to ask is this (js): if ( cond == true cond2 == true cond 3 == true cond4 == true ) correct ? or i can use only 2 statements for one if ? and should i use this or its better to use two if’s like this :

if ( cond == true  cond2 == true ) {
if ( cond3 == true  cond4 == true) Than do this !
}

i know that both will be executed but what is better option to choose?
thanks :slight_smile:

You can do more than just 2 conditions, just try it if you’re not sure about anything.

I prefer the first one, it is much more clear what you are doing.
You could format the line different if you feel it helps clear it up further:

if ( cond  == true  
     cond2 == true  
     cond3 == true  
     cond4 == true )

or, since you are checking for ‘true’, a shorter, cleaner way:

if ( cond  cond2  cond3  cond4 )

thanks :slight_smile:

That’s too many conditionals. Put the methods that yield the conditions in a collection and use All on it.