Re: TIB: Help with Nested FOR loops


[Prev][Next][Index][Thread]

Re: TIB: Help with Nested FOR loops




i hate to be a disappointment but im not sure if that will work
follow the numbers in order

 :For (I,1,sqr(c))      1)this line is fine
 :For (J,1,sqr(a))     2)same here
 :Stuff                    3)all the loop stuff
 :Goto B                4) program now jumps to b
 :Lbl A                   
 :End                     7)now the program comes to the second end 
increasing I
                             8)after the last I(when I=sqr(c))the program 
gets an error b/c it hits the second end after Lbl b and there is nothing to 
increase
:Lbl B         
 :End                     5)the program hits the first end it now increases J 
until j==sqr(a)
 :Goto A                6)now it goes to a
 
try this code
:25\->\A
:A\->\C
:for (I,1,sqr(C)
:for(J,1,sqr(A)
:Disp "I="
:Disp I
:disp "J="
:Disp J
:Pause
:Goto B
:Lbl A
:End
:Lbl B
:End
:Goto A

it increases j first (1 to 5) then it increases I by 1 then does J all over 
again
and after the last I it generates and error
maybe if i have time in physics or math tommorow ill work on something (in 
school is the only place i get programming. done to many distractions at home 
hehehe...)