IF: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 20: | Line 20: | ||
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. | 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]]. | See also [[conditional modelling]], [[SWITCH]], [[WHEN]] and [[SELECT]]. | ||
[[Category:Syntax]] | [[Category:Syntax]] | ||
Latest revision as of 08:05, 15 August 2010
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.