When is while loop more appropriate than for loop?:
The number of iterations is known in advance | |
The terminating condition occurs unexpectedly. | |
The program will be executed at least once | |
The body of the loop should be executed at least once |