Learn Visual C#
Lesson 4: C# Conditional Statements
√ What is Conditional Statement in C#?
√ How Conditional Statements Work?
√ Conditional Statements Keyword
What is Conditional Statement
Conditional statements in C# is a decision making process which executes only those set of codes which is required or return true by program.
In this chapter we are going to learn a very important topic in C# programming – Conditional Statements. In this chapter we will learn write and execute block of codes based on given condition. Your program may have several blocks of codes but the program will execute only those blocks which meet requirements. It is also known as branching of codes.
How Conditional Statements Work?
Conditional statements work on true or false signal. If program returns true then executed set of codes otherwise executed another set of codes.
If Else and Switch Case are the c# keywords which is used in writing conditional statements in programming. In the next few chapters we will learn if else constructs and switch case constructs in details. It is recommended to learn conditional statements very clearly because it is widely used in programming.
In this chapter you have learned what is conditional statement in C# and how it works. In the next chapter we will learn If Else statements in Details.