February 2014
Beginner
1248 pages
62h 25m
English
The for statement often can be represented with an equivalent while statement as follows:
initialization;while (loopContinuationCondition){ statement increment;}
In Section 5.8, we show a case in which a for statement cannot be represented with an equivalent while statement. Typically, for statements are used for counter-controlled repetition and while statements for sentinel-controlled repetition. However, while and for can each be used for either repetition type.
Read now
Unlock full access