You may be wondering why there are two statements available that do
exactly the same thing because the while and the for loop do exactly the
same thing. The while is convenient to use for a loop that you don’t
have any idea how many times the loop will be executed, and the for
loop is usually used in those cases when you are doing a fixed number
of iterations. The for loop is also convenient because it moves all of the
control information for a loop into one place, between the parentheses,
rather than at both ends of the code. It is your choice as to which you
would rather use.