Lesson #6 - Conditions and If Statements

Updated: Dec 13, 2020

As we saw in previous lessons, C# supports all the logical conditions (Equal, less than, etc.) that we can use to perform different actions in our code that base on different decisions. C# supports the following conditions statements:

The if Statement

Use the ‘if’ statement to specify a block of code to be executed if a condition is ‘True’.

And here is another example of nested if:

The Else Statement

Use the ‘else’ statement to specify a block of code to be executed if the ‘if’ condition is ‘False’.

The Else if Statement

Use the ‘Else If’ statement to specify a new condition if previous conditions are ‘false’.



1 view0 comments