C# offers multiple conditional/selection statements to help us make decisions throughout our programming. We can use all of the operators we learned about in the previous sections alongside these statements. These statements help the program take on a specific flow based on whether the expression is evaluated as true or false. These statements are the most widely used ones in C#.
The following table lists the available conditional/selection statements:
Expression | Description |
If..else | If statements evaluate the expression that's provided. If it is true, then the statements are executed. If it is false, then else statements are executed. |
Switch..case..default | Switch statements evaluate a specific expression and execute the switch section if the pattern matches the match expression. |
break | break allows us to terminate a... |