ProSoft Technology MVI56-BAS User Manual
Page 211
Advertising

MVI56-BAS ♦ ControlLogix Platform
BASIC-52 Implementation
BASIC Module (DB/BAS Compatible)
User Manual
ProSoft Technology, Inc.
Page 211 of 234
December 13, 2011
10.2.4 FOR-TO- (STEP)-NEXT
Sets up a control loop.
Syntax:
FOR [expr1] TO [expr2] STEP [expr3]
..
..
..
NEXT [expr5]
Example:
10 FOR A=0 TO 10 STEP 2
20 PRINT A
30 NEXT A
40 PRINT "END OF LOOP"
Result:
0
2
4
6
8
10
END OF LOOP
10.2.5 GOTO
Use the GOTO statement to force the BASIC program to jump to a specific line
number.
Syntax:
GOTO [line number]
Example:
10 PRINT "ENTER A NUMBER"
20 INPUT A
30 IF A>0 THEN GOTO 40 ELSE GOTO 60
40 PRINT "NUMBER IS POSITIVE"
50 GOTO 70
60 PRINT "NUMBER IS NEGATIVE"
70 END
10.2.6 END
Use END to terminate the program execution.
Syntax:
END
Advertising