Skip to main content

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>

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