Advent Instruments Inc.
4. Programming
Statements
The following table outlines the various program statements that can be used in a script
program for the AI-7280.
LET
Usage:
[LET] <variable> = <expression>
The LET statement computes the result of an expression and transfers the value to a variable.
The expression itself may contain variables, constants, literals, or function calls. The data
type of the variable must match the data type of the expression. As such, numeric variables
can only be assigned numbers and string variables can only by assigned strings.
Note, using the keyword LET is optional.
LOOP
Usage:
LOOP [<expression>]
<statements>
[EXIT LOOP]
END LOOP
Repeats a series of statements a specified number of times or an infinite number of times.
The optional expression following the LOOP keyword determines the number of times the
statements are repeated. If an expression is present it must evaluate to a numeric value. If no
expression is present the statements loop indefinitely. Optionally, an EXIT LOOP statement
immediately exits the loop.
FOR-NEXT
Usage:
FOR <var> = <exp1> TO|DOWNTO <exp2> [STEP <exp3>]
<statements>
[EXIT FOR]
NEXT <var>
Where:
<var> is a variable modified by the FOR-NEXT loop. Must be of a numeric data type.
<exp1> is an expression that represents the initial value for <var>. The expression must
evaluate to a numeric value.
<exp2> is an expression that represents the value compared to the <var>. If counting up
(TO keyword), the loop ends when the value of <exp2> is less than the <var>.
Otherwise when counting down (DOWNTO keyword), the loop ends when <exp2> is
greater than the <var> value.
If the optional STEP keyword is used, then <var> is incremented by <exp3> if counting
up (TO keyword), or decremented by <exp3> if counting down (DOWNTO keyword).
If the STEP keyword is not included in the statement, the <var> is either incremented or
decremented by the value of 1.
The FOR-NEXT statement is an alternative method for repeating a block of statements
instead of using the LOOP command. It steps a variable either higher or lower between a
start value and end value.
Optionally, EXIT FOR is used to break out of the loop.
IF-THEN-ELSE-ELSEIF
Usage:
IF <expression> THEN
<statements>
[ELSEIF <expression> THEN
<statements> ]
AI-7280 Programmers Guide - Direct Control
89