Visual Basic (Loops)
Created | Updated Jan 28, 2002
This page isn't finished and will be edited ALOT
Loops are used when you want to run a pice of code more than once without atualy having to write out the code time after time.
In visual Basic there are 4 ways of looping...
Do Loop Until
For to Next
While Wend
(and the ever so impressive)
If then Goto
Each had it's good point, and bad points... but all do rufly the same job.
Do Loop Until
this is a built in Looping, whaits for a specific arugment, then exits
if the argument goes after the Do VB will check before each new loop
if after the Loop VB will check at the end.
Syntax
Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]
Loop
Example
Do
a = a + 1
Loop Until a = 5
this will wait until a = 5 and then exit loop
This function is more simpistic and is faster to run than For to Next
For to Next
this is a loop that will count for you, and exit the loop once the counter has finsihed
Syntax
For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next [counter]