C# – Decision Making

  • Post author:
  • Post category:C#
  • Post comments:1 Comment
C# - Decision Making

Structures that require the programmer to specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

C# - Decision Making

C# Decision Making statements-

Click the links

Sr.No.Statement & Description
1if statement (AnĀ if statementĀ consists of a boolean expression followed by one or more statements.)
2if…else statement (AnĀ if statementĀ can be followed by an optionalĀ else statement, which executes when the boolean expression is false.)
3nested if statements (You can use oneĀ ifĀ orĀ else ifĀ statement inside anotherĀ ifĀ orĀ else ifĀ statement(s).)
4switch statement (AĀ switchĀ statement allows a variable to be tested for equality against a list of values.)
5nested switch statements (You can use oneĀ switchĀ statement inside anotherĀ switchĀ statement(s).)

The ? : Operator

We have coveredĀ conditional operator? :Ā in the previous chapter which can be used to replaceĀ if…elseĀ statements. It has the following general form āˆ’

Exp1 ? Exp2 : Exp3;

Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon.

Next Topic – Click Here NEXT PAGE – Click Here

This Post Has One Comment

Leave a Reply