I just discovered a really nice thing (thanks to Pernilla) using multiple conditions (&&, ||) in the if…else conditional statement in Actionscript. The thing I did not know (you probably did) is that the statement do not check the remaining conditions when a condition is not fulfilled. If you look at the image below you can see that we get a crash on line 32 but not on line 28. This is because we add a check to see if _userVO exists before we check the contents. We also get a crash on line 38 because we check the conditions in the wrong order.

if else conditional statement

This little tip will help me save some lines of code.

Post to Twitter