What if....
    Thierry Douez 
    th.douez at gmail.com
       
    Mon Jan 28 07:36:09 EST 2013
    
    
  
Hi Peter,
2013/1/27 Peter Haworth <pete at lcsql.com>
> Musings about complex if statements on this Sunday morning...
>
> if cond1 and cond2 and cond3 and cond4 then.....
>
> if cond1 then
>    if cond2 then
>       if cond3 then
>          if cond4 then...
>
> if cond1 and cond2 and (cond3 and cond4) then....
>
> Just curious.
> Pete
>
Wanting to show you in few lines of code, some differences with or wihtout
the (),
I came accros this interesting riddle...
So, smart livecoders, try to guess what would be the 4 answers to this
script;
then run it and thanks to comment :)
on mouseUp
   if false or true and false then
      answer "Got it 1!"
   else
      answer "False 1!"
   end if
   if false or (true and false) then
      answer "Got it 2!"
   else
      answer "False 2!"
   end if
   if false or true then
      answer "Got it 3!"
   else
      answer "False 3!"
   end if
   if false and false or true then
      answer "Got it 4!"
   else
      answer "False 4!"
   end if
end mouseUp
Regards,
Thierry
    
    
More information about the use-livecode
mailing list