if you've any further questions, let me know
Main Topics
Browse All TopicsI want to learn all the aspects of looping!
need some tut in looping!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
in vb
For i = 1 to 50
'do stuff
next i
do while i < 51
'do more stuff
loop
loops can be exited using the Exit for and exit do function
for i = 1 to 50
if i = 4 then
exit for
end if
i=i+1
next i
Loops can be nested
For each row in rows
for each col in columns
debug.write row,col
next col
next row
loops cant be step nested
for each row in rows
for each col in cols
debug.write row,col
next row
next col
Loops can also be infinite
i=1
Do while i > 0
i=i+1
loop
Ctrl & Break will rescue you....
Loops are useful to use with collections
dim dr as datarow
for each dr in dataset.tables(0).rows
debug.print dr("ThisField")
next dr
Everything inside a loop should be indented for clarity and so u can quickly see where the loop begins and ends
Sorry for cutting in drnick but I thought id give a more basic explanation.... Thanks for the assembler revisited though :? i knew there was a reason I never used it ;)
When writing Shell Scripts (batch files) for Windows NT, 2000, XP and Server 2003, see the FOR command is used for looping. See the cross-platform syntax at
(http://TheSystemGuard.com
An example of using a FOR loop is at
(http://BoomingOrFuming.co
See "The Labyrinths of FOR" about halfway down the page.
Business Accounts
Answer for Membership
by: drnickPosted on 2004-06-10 at 21:40:03ID: 11285880
there are 3 basic types of loops in most programming languages:
the FOR-type
with this loop, you run through a specific piece of code clearly definid times
example:
for(int i = 0; i < 10; i++)
{
printf("%d\n", i);
}
will print the numbers from 0 to 9, because the loop's body will be executed 10 times,
since i is zero at the beginning and is incremented AFTER each pass.
the WHILE-type
While loops have a loop condition which is always checked at the beginning.
int i = 2;
while(i > 0)
{
printf("%d\n", i);
}
will print 2 and 1.
the DO-loops (also often REPEAT/UNTIL)
int i = 2;
do
{
printf("%i\n");
} while(i > 0);
Will print 2, 1 and 0, because the loop's condition is at the loops bottom
and checked after each pass (in contrast to while-loops).
Note that you can translate all these loops into each other.
Some Languages also support FOR-EACH-loops,
which allow you to do an action for every item in a collection.
These were loops in High Level Languages (HLL).
However, a processor often doesn't support loop constructs,
so in machine code, loops are most commonly translated to
conditional jumps, which also can be used in most HLL:
int i = 2;
here: //label
printf("%d\n", i);
i--;
if(i >= 0) goto here; //jump
The intel 80x86 processor also support a special, optimized loop
statement for a special register (ECX/CX/CL) (which thus cannot be used
for nested loops):
MOV EAX, 1
MOV ECX, 100
@label:
INC EAX
LOOP @label
which will count ECX down to 0 while incrementing EAX up to 101.