O'Reilly logo

Microsoft®C# Programming for the absolute beginner by Andy Harris

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

Using a For Loop

The branching behavior you learned in Chapter 2, “Branching and Operators: The Math Game,” is very important because it gives your programs the capability to make rudimentary choices. The other major way to control the flow of your programs is through looping behavior. Loops are code structures that allow parts of your program to repeat. There are a couple standard types of loops. One prominent type of looping structure repeats a code segment some specified number of times. This counting loop is called the for loop. To demonstrate the for loop, I’ll imitate a bureaucrat.

Examining The Bean Counter Program

Although many of my sample programs are pointless, this one takes special pride in looking as though it’s doing something important. ...

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