
Commands - 38
DO/ENDDO
Statements
SYNTAX: DO value
.
.
.
ENDDO
PURPOSE: To execute a loop a number of times quickly.
REMARK S: value range is 1 to 65535. It can be a number or variable.
The DO /EN DDO statements cause a list of statements to be executed for a number of times. It is 3
times faster than using a FOR/N EXT loop.
You can NOT exit a DO/ENDDO with the EXIT statement A way to gracefully exit a DO/ENDDO
loop is to set DO = 1 then GOTO the line at ENDDO.
NOTE: Nesting of DO /EN DDO loops is NOT permitted. This construct' s speed is due to the use
of a single counter.
EXAMPLE: 10 A= - 45
20 DO 45
30 INC A:PRINT A
50 ENDDO
Nesting DO/ENDDO loops is NOT allowed. An example of what NOT to do is shown below.
DO 25
GOSUB ..routine
ENDDO
'
..routine
DO 50
A = AIN(0) + A
ENDDO
RETURN
A DO loop counter empty error is returned after the GOSUB routine.
ERROR: < ENDDO> – if ENDDO encountered without corresponding DO.
< DO loop counter em pty> - When a DO loop is nested and the most recent one was completed.
Comentários a estes Manuais