On 1/27/13 12:39 PM, Peter Haworth wrote:
Musings about complex if statements on this Sunday morning....
Lets say you have a complex if statement with 4 conditions that must all be
true. Is there any advantage, other than personal preference/style, to:
if cond1 and cond2 and cond3 and cond4 then.....
or
if cond1 then
if cond2 then
if cond3 then
if cond4 then...
In either case, as soon as a condition evaluates to false, none of the rest
are evaluated, right?
Right, both examples are equivalent. In the single line version (example
1) the conditions are evaluated left to right, and as soon as one is
false the rest are abandoned.
Parentheses indicate which conditions are part of a grouping but don't
influence the direction of evaluation.
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode