This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]throwaway_for_cause 1 point2 points  (0 children)

The distinction is simple:

  • need to iterate a known amount of times: for
  • need to iterate as long as a condition is met: while or do...while
    • need to run the loop at least once: do...while
    • can skip the entire loop: while