Yes, in any 'and' where the first condition is false, then the second condition
is not evaluated; similarly in any 'or', if the first condition is true, the
second isn't evaluated. Parentheses alter the order of evaluation as others
have said.
It's easy to prove this by writing a script where the thing generating your
condition ('a' in your example) is a function - you can then make the function
have a side effect. As sample function might be
function ReturnsTrue
put "condition returning true has been invoked;" after whatHappened
return true
end ReturnsTrue
you then write an 'if' statement which at some point in the logic calls
ReturnsTrue(), and when you look at the global 'whatHappened' you will see
whether the evaluation reached that point or not...
Graham
On 5 October 2011 16:25, Pete <[email protected]> wrote:
> No, I mean:
>
> If a is true then
> if (b is true or c is true) then
> do whatever
> end if
> end if
>
> I'm pretty sure if a was false, the second condition wouldn't be evaluated.
>
> But you raise an interesting point - in your example, does the condition
> inside the parens truly get evaluated first?
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode