The If Statement; The If; Nesting - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

IF and the Boolean Expressions
A Boolean expression can have one of two results: true or false. In Axcess, any non-zero value is
true, while a zero value is false. When Axcess evaluates a Boolean expression, it assigns a 1 for a
true result, and a Ø for a false result.

The IF Statement

The most common keyword in Axcess that uses Boolean expressions is the IF keyword. Every IF
statement must be followed by a Boolean expression enclosed in parentheses. This provides the
beginning of a conditional execution of statements, as shown in this example:
IF (Boolean expression)
(Statement 1)
If the Boolean expression is true, Axcess executes Statement 1 and continues with whatever
statements follow. If the Boolean expression is false, Statement 1 is ignored. If Statement 1 is a
compound statement, it must be enclosed in braces.
The IF...ELSE Set of Statements
If the Boolean expression is false, Axcess executes a function independent of the True Boolean
expression. For example:
IF (Boolean expression)
ELSE
If the Boolean statement is true, then Statement 1 is executed and Statement 2, underneath the
ELSE statement, is ignored. If the Boolean statement is false, then Statement 2 is executed.
Statement 1 is automatically ignored if the expression is false.
The IF...ELSE IF Set of Statements
While IF and IF...ELSE allow two different paths, IF...ELSE IF allows an essentially unlimited
number of paths. Axcess stops at the first true Boolean expression and executes the following
function. After completion, it goes on to the rest of the program. For example:
IF (Boolean expression)
ELSE IF (Boolean expression)
ELSE IF (Boolean expression)
A last ELSE statement (not ELSE IF) can be placed at the end as a default statement. Then, if
Axcess does not find a true IF or ELSE IF statement, it executes the final ELSE statement. This last
statement is not necessary.

Nesting

Once Axcess is following a branch (for example, Statement 1 in the previous example), you can tell
it to branch off again with another IF statement. This branch within a branch is called nesting. An
IF can be nested within an IF within an IF, and so on.
When you are nesting IF...ELSE statements, be sure to use braces. Look at the following incorrect
example:
64
(*Statement 1*)
(*Statement 2*)
(*Statement 1*)
(*Statement 2*)
(*Statement 3*)
(* As many Else If statements as memory allows... *)
Axcess Programming Language

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Axcess

Table of Contents