You must be over the age of 18 and agree
to the terms of service to access this page.
By default a limited blacklist has been applied hiding content that is commonly objected to. You may remove
items from this blacklist by using the blacklist menu item.
MrCrowely
MemberWhen you forget to add 'x++' to a while loop.
AnotherFluffyDerg
MemberThis irked me enough to find my login.
A) You should use a for loop if you want to increment a counter to mark the progression of the loop and terminate it upon running through the required number of executions. The format of for and the way it establishes and executes expressions is significantly more optimal for tasks that use this than a while loop.
B) Use 'i' instead of 'x' if you're incrementing an integer for a loop. It is convention and should be followed to avoid conniptions.
C) '++i' is better. Don't let the compiler take the love out of optimisation.
The more accurate statement if you want to keep referencing a while loop would be forgetting to set the exit evaluation to a criteria that does eventually swap to false.
zodiac
MemberIRL fork bomb
Login to respond »