View Full Version : Loops
10-22-2008, 01:02 AM
Okay, so I've been taking computer programming for about 9 weeks now, and I love it! But does anyone have any tips for completing do while loops?
10-24-2008, 01:41 PM
What do you mean by "completing"?
A while loop and a for loop are just different ways of writing the same thing.
I'm going to give examples in C because you have not specified a language and many languages share C syntax.
for(a; b; c)
is about the same as
}if that helps.
while(b);is similar but "b" only gets evaluated after one pass, so it is guaranteed to run once.
You can also use "continue" and "break" to either stop the current pass of the loop and continue on to the next pass of the loop or break out of the loop entirely, respectively.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.