O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

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

6.1. Introduction

In this chapter, we introduce several of C#’s remaining control statements. (The foreach statement is introduced in Chapter 8.) The control statements we study here and in Chapter 5 are helpful in building and manipulating objects.

Through a series of short examples using while and for, we explore the essentials of counter-controlled repetition. We create a version of class GradeBook that uses a switch statement to count the number of A, B, C, D and F grade equivalents in a set of numeric grades entered by the user. We introduce the break and continue program-control statements. We discuss C#’s logical operators, which enable you to use more complex conditional expressions in control statements. Finally, we summarize C#’s control ...

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