
Chapter 11 Flow Control Statements
11-13
Example
DEFINT li1, li2, li3, li4, li5, li6, li7, li8, li9
DO WHILE li1 > li2 'Executes a head decision iteration.
IF li1 = 4 THEN EXIT DO 'Exits from DO-LOOP if li1 = 4.
FORli3=0TO5 'Repeats the process of FOR-NEXT 5 times.
FOR li4 = li5 TO li6
'Repeats the process of FOR-NEXT by adding 1 to the
'value of li5 every time the repetition is done until
'li5 becomes the value of li6.
FORli7=1TOli8STEP 2 '
Repeats the process of FOR-NEXT by adding 2 to the value
'
every time the repetition is done from 1 until it becomes li8.
IF li2 = 2 THEN EXIT FOR 'Exits from FOR-NEXT if li2 < 0.
DO WHILE li2 < li9 'Executes a head decision iteration.
GOSUB *samp2
li9=li9+1
LOOP 'Calls a GOSUB *samp2 statement until li2 < li9.
NEXT li7 'Repeats.
NEXT 'Repeats.
NEXT 'Repeats.
li9=0
DO 'Executes a tail decision iteration.
GOSUB *samp2
li9=li9+1
LOOP UNTIL li9 < 5 'Calls a GOSUB *samp2 statement until li9 < 5.
LOOP 'Repeats.
Comentarios a estos manuales