About
In this code snippet, we will learn how to use the if, else if and switch decision statements in C#.
The if decision statement will evaluate the expression provided in the brackets. If the expression is true the first code block executes else the other code block executes.
The switch statement is useful when you have a lot of checks to perform. You pass the value to be compared into the switch statement. Then you can write multiple cases for different possible values.
Now let’s see how to do it in the code below.
Code:
[amp-gist id=”7544aaf17c5476f2e662000b0a7e51ae”]