Evaluation of complex conditions

Richard Gaskin ambassador at fourthworld.com
Thu Oct 6 17:38:32 EDT 2011

Pete wrote:

> I wrote a couple of functions (condition1 and condition2), each of which
> puts its identity after a script variable named myResult then returns true.
>  I then wrote the following:
> put empty into myResult
> if condition1() is true and condition2() is true then put myResult
> As expected, this displayed 12 in the message box.
> Then I changed the if statement to :
> if condition1() is true and (condition2() is true) then put myResult
> The message box still ended up with 12 in it, not 21 as you would expect if
> the parens had any effect.  Maybe I'm misunderstanding something but it
> doesn't seem like parens have any effect on the order of evaluation.

Parens only affect things within them.  They work much like algebra in 
that regard.

  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

More information about the Use-livecode mailing list