Xl™ series – Xylem XL-BASIC Programming Guide User Manual

Page 10

Advertising
background image

23-10 XL-BASIC Programming Guide

XL™ SERIES

Example:

goto 1000
end
1000
print "code execution continues here"

FOR / TO / NEXT

This is a “For To” loop with the following form:

FOR var = start value TO end value
Command(s)
NEXT

Example:

for x = 1 to 10
Print x
Next

The start value and end value must be whole numbers with the start value
less than the end value. There can be 5 nested FOR / TO / NEXT sections.

IF / THEN

IF condition THEN action. Condition is a logical expression that
evaluates to true or false. If the condition is true then the
desired action is executed. Valid conditional operators are:

Operator Example
<

a < b

a less than b

>

a > b

a greater than b

<=

a <= b

a less than or equal to b

>=

a >= b

a greater than or equal to b

= =

a = = b

a equal to b

!=

a != b

a not equal to b

Example:

if stage>10 then print "stage is greater than 10"

Most commands can be used after the THEN statement. A few
possibilities are listed below:

Then goto ####
Then gosub ####
Then measure(x)
Then delay(#)

END

All programs should end with this statement.

Advertising