|
-
Nov 20th, 2000, 09:57 AM
#1
Thread Starter
New Member
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
-
Nov 20th, 2000, 10:23 AM
#2
transcendental analytic
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
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 20th, 2000, 10:35 AM
#3
Addicted Member
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.....
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
[Edited by ender_pete on 11-20-2000 at 10:38 AM]
 ender_pete 
C#,VS.NET Ent Arch, vb6 ee sp5,html,vbscript,jscript,
xml,dhtml,delphi,c++,vc++,java,cgi,php, python, ada(so ancient) ,adasage(also ancient) and others i can't remember.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|