I know a while loop can do anything a for loop can, but can a for loop do anything a while loop can?
Please provide an example.
The while loop and the classical for loop are interchangable:
while
for
for (initializer; loop-test; counting-expression) { … } initializer while (loop-test) { … counting-expression }