created by zetrystan
Viewing sample resized to 21% of original (view original) Loading...
Blacklisted
  • Comments
  • mrcrowely said:
    When you forget to add 'x++' to a while loop.

    This 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.

  • Reply
  • |
  • 7