pete at lcsql.com
Sun Jan 27 13:39:23 EST 2013
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.....
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? If so, then always best to put the conditions that
take the longest to evaluate further down the list, for example perhaps an
SQL SELECT statement that might take a while to execute? But then what if
some of the conditions are in parens, for example:
if cond1 and cond2 and (cond3 and cond4) then....
The manual says the grouping operator (parens) has the highest precedence
so does this mean (cond3 and cond4) will be evaluated before cond1 and
lcSQL Software <http://www.lcsql.com>
More information about the Use-livecode