Multiple conditions in an IF statement ...

Hi,

How do I script :

If condition1 is true or if condition2 is false then
do this
an that
and that
and that also
end if

I wonder how I can write that without having to write the «do this and that» statements 2 times. Thanks in advance.

Robert Lespérance

Hi,

If all this and that statements are one-liner, the fastest way is write the line twice.
If the number of repeats is more then 2, use a repeat loop.
If the this and that statements contain more than one line, use a handler like


if condition1 or not condition2 then -- is the same as "if condition1 is true or condition2 is false then"
	-- do this
	and_that()
	and_that()
	-- and that also
end if

on and_that()
	-- do something
	-- do something else
end and_that

Hi StefanK,

Trivial … My error was that «conditons» needed parenthesis to work, like the statement below:

if (process "ScreenSaverEngine" exists) or (currentUser is not equal to userID) then

Regards.

Robert