Control Statements SECTION 4 CX-Supervisor Script Language
26
Typical Examples
IF burner AND fuel > 0 AND rate > 0 THEN
lift = lift + rate/5
ELSE
count = 1
IF altitude > 140 THEN
lift = lift - 0.2
ENDIF
ENDIF
Provided a successful evaluation has been made to points 'burner' AND 'fuel'
AND 'rate', point 'lift' is updated with the current value of rate divided by 5 plus
'lift'. Otherwise, a further evaluation is required on point 'altitude'. If 'altitude' is
currently greater than 140, then 'lift' is decremented by 0.2.
IF burner AND fuel > 0 AND rate > 0 THEN
lift = lift + rate/5
ELSE
IF altitude > 140 THEN
lift = lift - 0.2
ENDIF
ENDIF
IF burner AND fuel > 0 AND rate > 0 THEN
lift = lift + rate/5
ELSEIF altitude > 140 THEN
lift = lift - 0.2
ENDIF
These two examples are identical. The use of the ELSEIF statement
combines the ELSE statement and the IF/ENDIF statements for brevity. It is
acceptable to have more than one ELSEIF statement in an IF THEN ELSE/
ELSEIF ENDIF construct.
References
Argument Description
conditionA The condition is made up of points and constants, using
relational, logical or arithmetical notation as a test. The
condition can evaluate Boolean state 'TRUE' and
'FALSE', Integer or Real numbers, or a text string.
conditionB This condition is nested in the first condition, either on a
successful or unsuccessful evaluation of conditionA.
The condition is made up of points and constants, using
relational, logical or arithmetical notation as a test. The
condition can evaluate Boolean state 'TRUE' and
'FALSE', Integer or Real numbers, or a text string. There
is no limit to the number of nested conditional
statements.
statementblock1 One or more statements which are performed if
conditionA is met.
statementblock2 One or more statements which are performed if
conditionA is not met.
statementblock3 One or more statements which are performed if
conditionB is met.
statementblock4 One or more statements which are performed if
conditionB is not met.