Evaluation of complex conditions
Pete
pete at mollysrevenge.com
Thu Oct 6 17:49:36 EDT 2011
Yes, that's what I would have expected but just double checking since
someone mentioned otherwise - back to "precedence" versus "evaluation" again
I think.
Pete
Molly's Revenge <http://www.mollysrevenge.com>
On Thu, Oct 6, 2011 at 2:38 PM, Richard Gaskin
<ambassador at fourthworld.com>wrote:
> 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<http://LiveCodejournal.com/blog.irv>
>
>
> ______________________________**_________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>
>
More information about the use-livecode
mailing list