Nested loops are where you have loops inside each other. Obviously this is very useful ;) The only
thing you really need to remember is that the the whole of the inner loop must be on the inside of the outer loop.
In other words you cannot do things like this:
Start outer loop
Start inner loop
End outer loop
End inner loop
An example of some correctly nested loops:
 |
; You can see that the inner loop is repeated every time round the outer loop
For i.w=0 To 10
For j.w=0 To 10
NPrint "i=",i," j=",j
Next
Next
; Of course, you can nest any kind of loops, and have as many levels of nesting as you like
; (as long as you stick by the rule that loops must be entirely inside each other)
i = 0
Repeat
j = 10
While j > 0
If i < j
Select j-i
Case 1
NPrint "Well, that's about as close as they can get :)"
Case 2
NPrint "Oooh, getting closer"
Case 3
NPrint "Things starting to heat up now"
Default
NPrint "Don't make me laugh foo!"
End Select
EndIf
j+1
Wend
i+1
Until i=10
MouseWait
End
|
|