Page 1 of 1

check if two conditions

Posted: Thu Jan 20, 2022 12:53 pm
by Samuele
Hi, how can i check if condition or another condition then do something?
in other words, if one of the 2 conditions is true then do something
thanks!

Re: check if two conditions

Posted: Thu Jan 20, 2022 1:12 pm
by richmond62
Simple logic:

Code: Select all

on mouseUp
   if fld "f1" is empty then
      -- do nothing
   else
      add 1 to XXX
   end if
   if fld "f2" is empty then
      -- do nothing
   else
      add 1 to XXX
   end if
   if XXX > 0 then
      put "Yippee!" into fld "f3"
   else
      put empty into fld "f3"
      end if
end mouseUp
-
Screen Shot 2022-01-20 at 2.11.08 PM.png

Re: check if two conditions

Posted: Thu Jan 20, 2022 1:20 pm
by Klaus
Hi Samuele,

you already mentioned it! Use OR! :-)

Code: Select all

...
if fld "your field" = EMPTY OR some_variable = 42 then
  ## do something
end if
...
Best

Klaus

Re: check if two conditions

Posted: Thu Jan 20, 2022 6:10 pm
by Samuele
Thanks!, that worked