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 statements-
Click the links
Sr.No. | Statement & Description |
---|---|
1 | if statement (AnĀ if statementĀ consists of a boolean expression followed by one or more statements.) |
2 | if…else statement (AnĀ if statementĀ can be followed by an optionalĀ else statement, which executes when the boolean expression is false.) |
3 | nested if statements (You can use oneĀ ifĀ orĀ else ifĀ statement inside anotherĀ ifĀ orĀ else ifĀ statement(s).) |
4 | switch statement (AĀ switchĀ statement allows a variable to be tested for equality against a list of values.) |
5 | nested 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
Pingback: C# - Operators - Adglob Infosystem Pvt Ltd