O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required