IF
/ELIF
/ELSE
IF
/ELIF
/ELSE
allow(s) you to run code, only if a certain condition is met.
ELIF
can only come after an IF
, and ELSE
can only come after an ELIF
or IF
. If any IF
or ELIF
are true, then all subsequent ELIFs and ELSEs are ignored. After that, you can create a new IF
statement by using the IF
command once again.
System Var:
$IF_SUCCESS
If success is true if there was a recent IF
/ELIF
statement that resulted to TRUE
. Value is reset to FALSE
if there is a new IF
statement is created, and results to FALSE
.
Syntax
IF <condition>
<codeBlock>
- Single Conditional
- Multiple Conditionals
DucklingScript
VAR a 10
REM if a is equal to 10
IF a == 10
REM this code is ran
STRINGLN Hello World
REM if a is not equal to 10
ELSE
STRINGLN Hello World Not Found :/
Compiled
STRINGLN Hello World
DucklingScript
VAR a 10
IF a > 10
STRING a is greater than 10
ELIF a < 10
STRING a is less than 10
ELSE
STRING a is 10
Compiled
STRING a is 10