Hardware manual

Impact Reference Guide Statement syntax
5-5 Datalogic Automation Inc.
*Note: For the compare operators (<, <=, >, >=), the result of the operation is undef if any of the operands is
undef.
Statement syntax
Statements consist of assignments, functions, or commands written on a single line. You can leave blank
lines between statements for readability. Spacing within a statement is optional. For example, "A=B+C" and
"A = B + C" are equivalent. See page 5-30 for some examples of Basic program code.
You should also insert comments in your programs to make them easier to understand. See “Comments” on
page 5-2.
Loop constructs
Loops let you process a series of commands a set number of times. The following loop constructs are avail-
able.
WARNING: Be careful that you do not create an "infinite" loop in the Basic tool. For example, if a variable
that controls the loop is incorrectly set, the tool may never exit the loop and may run indefinitely. The tool
will abort after the Task Timeout time has elapsed only if the task is online and triggering, but not when the
Run button is clicked. (See “Enable Timeout” on page 2-6)
Do Until
Do Until expression
REM loop body
Loop
This construct repeats the loop body until the expression is True. The expression is evaluated before entering
the loop so the loop is not executed if the expression is already True.
Do While
Do While expression
REM loop body
Loop
This construct repeats the loop body while the expression is True. The expression is evaluated before enter-
ing the loop so the loop is not executed if the expression is already False.
For Next
FOR variable = StartValue TO EndValue STEP StepValue
REM loop body
NEXT
This loop construct starts by setting the value of variable equal to StartValue. After the execution of the loop,
the variable is increased or decreased by the value of StepValue. The loop is repeated as long as the value of
variable is equal to or less than the value of EndValue. If StartValue is already greater than EndValue, the
loop is never executed.
The keywords STEP and StepValue are optional. If they are omitted, StepValue is one.
NOT Logical negation: calculates the logical negation of the operand (e.g. NOT True;
the result is False)
Operator Operator Meaning