Page 1 of 1

nested do loops

Posted: Fri Mar 16, 2007 12:35 pm
by pronoland
HOW DO I:

K = O
DO WHILE K < 15
K=K+ 1
L=0
DO WHILE L <200
I(L) =0
LOOP
LOOP

END
HOW DOES basic know which loop goes with whichdo statement?

Posted: Fri Mar 16, 2007 2:41 pm
by bungytheworm
Pretty easily after all.
Last DO what is stated, is cut by first LOOP.

Code: Select all

DO ' first
   DO ' second
     DO ' third

     LOOP ' third DO is last stated so its ended here
   DO ' third is now out so second DO is ended here
LOOP ' only first DO alive so we end it here.
So you cant end first DO, before third and second are ended.