CHAPTER 5Program Control Statements
This chapter discusses C#’s program control statements. There are three categories of program control statements: selection statements, which are the if and the switch; iteration statements, which consist of the for, while, do-while, and foreach loops; and jump statements, which include break, continue, goto, return, and throw. Except for throw, which is part of C#’s exception-handling mechanism and is discussed in Chapter 13, the others are examined here.
The if Statement
Chapter 2 introduced the if statement. It is examined in detail here. The complete form of the if statement is
if(condition) statement;
else statement;
where the targets of the if and else are single statements. The else clause is optional. ...
Get C# 4.0 The Complete Reference 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.