If statement
✏ Beginners Scripting Guide ✏
In this section, we will discuss how if statement works. An if statement is a code of block that will be executed whenever the if statement's condition is met.
CONDITION OPERATIONS
>= (Condition 1 greater and equal to condition 2)
<= (Condition 1 less and equal to condition 2)
~= (Condition 1 is not condition 2)
== (Condition 1 is equal to condition 2)
First example:
if 1 > 0 then -- This will check if 1 > 0 or not.
-- Code block in here will be executed when condition(s) are/is met
print('1 is greater than 0')
endSecond example:
if not 1 > 3 then -- This will check if 1 > 3.
-- The statement is false but we use the "not" to flip that false to the opposite value which is true.
print('1 is greater than 0')
endand can be used to combine multiple statements together
or evaluates to true if either one of the statement is true
elseif can be used to extend the if statement.
else can be used to check if the condition is not true or opposite.
Last updated