check if two conditions

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

check if two conditions

Post by Samuele » Thu Jan 20, 2022 12:53 pm

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!
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: check if two conditions

Post by richmond62 » Thu Jan 20, 2022 1:12 pm

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
Attachments
BICONDITIONAL.livecode.zip
Here's the stack.
(1.21 KiB) Downloaded 108 times

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: check if two conditions

Post by Klaus » Thu Jan 20, 2022 1:20 pm

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

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: check if two conditions

Post by Samuele » Thu Jan 20, 2022 6:10 pm

Thanks!, that worked
Samuele.

Post Reply