IF

From ASCEND
Jump to: navigation, search

The IF statement is used to define conditional procedural code, and can only appear in a METHOD definition. Its syntax is

IF logical_expression THEN
    list_of_statements
ELSE
    list_of_statements
END IF;

or

IF logical_expression THEN
   list_of_statements
END IF;

If the logical expression has a value of TRUE, ASCEND will execute the statements in the THEN part. If the value is FALSE, ASCEND executes the state- ments in the optional ELSE part. It's a good idea to use () to make the precedence of AND, OR, NOT, ==, and != clear to both the user and the system.

See also conditional modelling, SWITCH, WHEN and SELECT.