Operators
X = 12
Y = 15
IF (X > Y)
(* Statement 1 *)
ELSE
(* Statement 2 *)
Notice that the result of the expression (X > Y) determines the path Axcess takes. Since X is less
than Y, Statement 1 is bypassed and Statement 2 is executed. You do not have to specify two paths.
However, if there is no ELSE present, Axcess will skip the statement or compound statement
underneath the false relational expression.
True and false
When a condition or expression is evaluated as true, it is given the value of 1; if the condition or
expression is false, it is given the value of Ø. When Axcess encounters an IF, it continues to the next
statement only when the result of the IF statement is a non-zero (true) value. Otherwise, Axcess
does not execute the statement directly under the IF statement.
It is possible, then, to assign a relational expression to a variable. For example:
DEFINE_PROGRAM
X = 9
Z = (X > 5)
IF (Z)
{
SEND_STRING Ø,"'X IS GREATER THAN 5',$ØD,$ØA"
}
In this case, Z will be equal to 1 since the expression (X > 5) is true. As a result, the following IF
statement is also true and Axcess executes Statement 1.
Only one relational operator should appear within a set of parentheses; two or more of these
operators can produce unexpected results. For example:
X = 5
IF (1Ø > X > 3)
{
SEND_STRING Ø,"'THIS STATEMENT NEVER GETS EXECUTED',$ØD,$ØA"
}
In the example above, 10 > X is evaluated first. Axcess assigns this part a value of 1 (true). Finally,
1 > 3 is evaluated. Since this is false, Statement 1 is not executed.
Since you cannot compare X to two different values in this manner, you should use a logical
operator.
48
(* X IS GREATER THAN 5 *)
Axcess Programming Language
Need help?
Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?