var b:Boolean = condition1() && condition2();
In this statement, if condition1()
evaluates to false, will condition2()
be evaluated?
var b:Boolean = condition1() && condition2();
In this statement, if condition1()
evaluates to false, will condition2()
be evaluated?
Yes. The &&
operator (and also ||
) is short-circuited.
This has been explained in http://192.150.14.22/livedocs/flash/9.0/ActionScriptLangRefV3/operators.html#logical_AND.
Returns
expression1
if it isfalse
or can be converted tofalse
, andexpression2
otherwise. Examples of values that can be converted tofalse
are0
,NaN
,null
, andundefined
. If you use a function call asexpression2
, the function is not called ifexpression1
evaluates tofalse
.
A little googling indicates yes. Also, the usual term is short-circuited, rather than lazy.