DI-159 PLC Hardware Manual
StickOS
Conditional Statements
Non-looping conditional statements are of the form:
if
expression
then
statements
elseif
expression
then
statements
else
statements
endif
Where statements is one or more program statements and the elseif and else clauses (and their
corresponding statements) are optional.
Alternately, the string form of this statement is:
if
string relation string
then
statements
elseif
string relation string
then
statements
else
statements
endif
Examples
>
10 dim a
>
20 for a = -4 to 4
>
30 if !a then
>
40 print a, "is zero"
>
50 elseif a%2 then
>
60 print a, "is odd"
>
70 else
>
80 print a, "is even"
>
90 endif
>
100 next
>
run
-4 is even
-3 is odd
-2 is even
-1 is odd
0 is zero
1 is odd
2 is even
3 is odd
50
Summary of Contents for DI-159
Page 51: ...StickOS DI 159 PLC Hardware Manual 4 is even _ 51...
Page 76: ...DI 159 Block Diagram 76...
Page 77: ...Dimensional Drawing 77...