Posts: 2,421
Threads: 52
Joined: Mar 2009
Reputation:
0
But the wiki has been reviewed by many people, i just think the info there is most likely better than what people can tell you here. Plus that page gives a complete explanation of both statements.
I think in the rules of this forum it says you must search before posting threads. (or at least it used to)
Posts: 526
Threads: 59
Joined: Feb 2011
Reputation:
0
Just like the wiki says.
A 'for' loop is the same as the 'while' loop, only compressed. That means you don't need to write the 'new a;' and 'a++;'. Hope you get what i mean.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
For is used when you know how many times you want to iterate, while is for the other case. For example; you don't usually know how many lines there are in a file or how many rows were returned by SQL query.
Posts: 2,421
Threads: 52
Joined: Mar 2009
Reputation:
0
As long as the expression after 'while' evaluates to true the code will loop.