IF statement in ST

Syntax
IF ... THEN
...
ELSIF ... THEN
...
ELSE
...
END_IF;

Meaning

Use the IF statement to specify that a group of statements is to be executed only if the associated Boolean →expression evaluates to value TRUE (or an equivalent). If the condition evaluates to value FALSE (or an equivalent), then either no statement is to be executed, or the statement group following the ELSE keyword (or the ELSIF keyword if its associated Boolean condition evaluates to value TRUE or an equivalent) is to be executed.

Example
FUNCTION_BLOCK ExampleIfDocumentation
VAR
up : BOOL;
count : INT;
END_VAR
IF up THEN /* If 'up' = 'TRUE', counter counts up. */
count := count + 1;
ELSE
count := count - 1;
END_IF;
END_FUNCTION_BLOCK