Lesson 4

Lesson 4: C# Conditional Statements


Objective

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.


Conditional Statements

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.

Topics

  1. If Else
  2. Nested If
  3. Switch Case
  4. Exercises

Summary

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.

BackNext