C# Programming Tutorial 7 - Conditional Statements (if, else, else if)

Опубликовано: 17 Октябрь 2024
на канале: Daniel Wood
11,271
64

Sample code and examples: http://www.codemahal.com/video/making...

In this tutorial you will learn how to make comparisons in C# using the following conditional statements: if, else if, else.

We can check, for example, if a number is less than, greater than, less than or equal to, greater than or equal to, equal to, or not equal to another number. We can also check if a string variable is equal to another string value (for example, checking if a password is correct). To make comparisons, we will need to be familiar with comparison operators. Comparison (or equality) operators are used to compare two values. The result of using an equality operator can either be true or false. The only type of variable that can store the result of an equality operator is a Boolean.