End -5, Examples, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 89: Syntax, Example, Simple do-until nested do-until

Advertising
background image

Publication 1746-RM001A-US-P

Control Functions 7-5

Examples

Simple DO-UNTIL

Nested DO-UNTIL

>1

REM EXAMPLE PROGRAM

>1

REM EXAMPLE PROGRAM

>10 A=0

>10 DO

>20 DO

>20 A=A+1

>30 A=A+1

>30 DO

>40 PRINT A

>40 C=C+1

>50 UNTIL A=4

>50 PRINT A,C,A*C

>60 PRINT “DONE”

>60 UNTIL C=3

>70 END

>70 C=0

>RUN

>80 UNTIL A=3

>90 END

RUN

END

Purpose

Use the END statement to terminate program execution. CONT does not operate
if the END statement is used to terminate execution. An

ERROR : CAN’T

CONTINUE

prints to the console. Always include an END statement to properly

terminate a program.

Syntax

END

Example

End Statement Termination

>1 REM EXAMPLE PROGRAM

>10 FOR I = 1 TO 4

>20 PRINT I,

>30 NEXT I

>40 END

READY

>RUN

1

2

3

4

READY

>

Advertising