C#.NET Loop Control and Decision Control Statements

Decision Control Statements in C#

The Decision Control Structures help you to perform actions based on a certain condition.

  1. if else
  2. Nested if
  3. if-else-if Ladder
  4. switch

Let me  explain this with 2 real world examples:

1. If I feel Thirsty I drink water(or beer!) else I eat pizza!

2. Consider a situation where you get into a fight with someone in college.

Here is the decision making your mind does:

if ( The other person is weaker than me)

Beat the shit out of him!


Keep Quiet and move on !!

We face such situations every day in our life where we have to take decisions based on a condition. To implement such situations in C# we use these Decision Making Control Structures.

Loop Control Statements in C#

The Loop Controls in C# help us to keep performing a task a certain number of times or until a certain condition becomes true.

The loop constructs available in C# are:

  1. while loop in C#
  2. do while loop in C#
  3. for loop in C#
  4. foreach loop in C#

Example: Suppose, you are playing football,

You keep playing football until you feel tired. (while, Do while)

You keep playing football for 45 minutes continuously i.e. till half-time break (Similar to for loop)

Banner to

Hide Page Information