Looping

Many programming problems are solved by repeatedly acting on the same data.

Iteration means doing the same thing again and again. The principal method of iteration is the loop.

The Roots of Looping goto

In the primitive days of early computer science, loops consisted of a label, some statements, and a jump.

In C++, a label is just a name followed by a colon (:). The label is placed to the left of a legal C++ statement, and a jump is accomplished by writing goto followed by the label name.

Why goto Isn't Used

goto is generally not used in C++, and for good reason. goto statements can cause a jump to any location in your source code, backward ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.