how do i use the (counter)command to do a nested loop.
eg. for counter=1 to 10
Print"*";
Next counter
How do i use an other counter to loop the program so that it prints a 10 by 10 square of *.
Thank you for your help
Printable View
how do i use the (counter)command to do a nested loop.
eg. for counter=1 to 10
Print"*";
Next counter
How do i use an other counter to loop the program so that it prints a 10 by 10 square of *.
Thank you for your help
counter isn't a command, it's a variable you use. In this case you use it to count the loops, you can use whatever variable for this purpose have as many nested loops as you want.
Code:For y=1 to 10
for x=1 to 10
print "*";
next x
print 'a linefeed
next y
you can't use they same variable in a nested loop because you will get the already in use error but this will do what you wanted.....
[Edited by ender_pete on 11-20-2000 at 10:38 AM]Code:Dim counter, counter2, num As Integer
counter = 1
counter2 = 1
num = 0
For counter = 1 To 10
num = num + 1
Form1.Print num
counter2 = 1
For counter2 = 1 To 10
num = num + 1
Form1.Print num
Next counter2
Next counter