beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 210

background image

BASIC-52 Implementation

MVI56-BAS ♦ ControlLogix Platform

User Manual

BASIC Module (DB/BAS Compatible)

Page 210 of 234

ProSoft Technology, Inc.

December 13, 2011

10.2 Control Expressions

10.2.1 IF-THEN-ELSE

Sets up a conditional test.

Syntax:
IF condition THEN action1 ELSE action2

Example:

IF A>0 THEN B=0 ELSE B=1

10.2.2 DO-UNTIL

Sets up a loop control until the condition specified in the UNTIL operator is not

satisfied.

Syntax:
DO action UNTIL condition

Example:

10 A=1
20 DO
30 PRINT A
40 A=A+2
50 UNTIL A>20

10.2.3 DO-WHILE

Sets up a loop control while the condition specified in the WHILE operator is

satisfied.

Syntax:
DO action WHILE condition

Example:

10 A=1
20 DO
30 PRINT A
40 A=A+2
50 WHILE A<20