Statements

Statements represent instructions. They specify the action to be performed. C# supports most of the statements found in C and C++. However, some of these statements have been modified to suit the C# specifications.

Statements can be classified as

Selection Statements

The Microsoft C# Language Reference states that a selection statement “selects one of a number of possible statements for execution based on the value of a controlling expression.” The following sections take a close look at each kind of selection statement.

The if Statement

The if statement is one of the fundamental selection statements and one of the most commonly used. In an if ...

Get Special Edition Using C# 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.