C# control statements-Almost every programming languages allows you to execute a code when a certain condition is met. This adds logic to your program. Imagine a program that cannot make decisions and execute every line of code. That would be okay if you just want to print a messages in a screen. But what if you want to print a certain message if the value of a variable is equal to a specified number. C# offers different ways to add this kind of behavior to your program. In the following of lessons, you will learn the following C# control statements:

  • The if Statement
  • The if else Statement
  • The Ternary Operator
  • Multiple Selection if Statements
  • Nesting if Statements
  • Logical Operators
  • The switch Statement