Now that you can iterate over a block of statements, the next related concept is how to control the flow of program execution. C# defines two simple constructs to alter the flow of your program, based on various contingencies:
The if/else statement
The switch statement
First up is our good friend the if/else statement. Unlike in C and C++, however, the if/else statement in C# operates only on Boolean expressions, not ad hoc values such as −1 or 0. Given this, if/else statements typically involve the use of the C# operators shown in Table 3-7 in order to obtain a literal Boolean value.
|C# Equality/Relational ...|