The Select - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

IF (X = 5)
IF (Y = 1Ø)
ELSE
The alignment of the ELSE statement with the IF (X = 5) suggests that they should be associated.
The second IF statement in this example is not intended to have an ELSE counterpart. However,
Axcess pairs the second IF statement with the ELSE, because the compiler associates the ELSE
with the closest IF statement.
Braces force the compiler to associate the ELSE with IF (X = 5). For example:
IF (X = 5)
{
IF (Y = 1Ø)
}
ELSE
By using braces, you isolate the IF (Y = 1Ø) statement from the IF...ELSE set of statements.
The SELECT...ACTIVE Statement
The SELECT...ACTIVE statement makes IF...ELSE IF nesting easier, by allowing placement of
several branches from one path. This is the format:
SELECT
{
ACTIVE (Boolean expression 1) : (*Statement 1*)
ACTIVE (Boolean expression 2) : (*Statement 2*)
ACTIVE (Boolean expression 3) : (*Statement 3*)
}
If too many IF...ELSE IF statements are chained together, a run-time error could occur.
Each one of the Boolean expressions is evaluated in order, until one is found to be true. The
statements associated with the true expression are then executed, and the path flows to the
statements following the closing brace. Using SELECT...ACTIVE is preferable to using multiple
IF...ELSE IF statements since it uses less memory, and runs faster.
When using the IF...ELSE set of statements, the code following the ELSE is the default statement.
If the condition of the IF is false, then the default statement following the ELSE is executed. If none
of the conditions in a SELECT...ACTIVE statement are true, no code of any ACTIVE statement
will be executed, since SELECT...ACTIVE has no default statement. The following example shows
how to create your own default statement for a SELECT...ACTIVE.
Axcess Programming Language
(*Statement 1*)
(*Statement 2*)
(*Statement 1*)
(*Statement 2*)
IF and the Boolean Expressions
(*
...etc.
*)
65

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Axcess

Table of Contents