Decision-making structures require that the programmer 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.
S.No. |
Statements & Description |
1 |
if Statement
The general working of this statement is that first a condition is
evaluated in the if statement. If the condition is true, it then
executes the statements. |
2 |
if/else Statement
The general working of this statement is that first a condition is
evaluated in the if statement. If the condition is true it then executes
the statements thereafter and stops before the else condition and exits
out of the loop. If the condition is false it then executes the
statements in the else statement block and then exits the loop. |
3 |
Nested If Statement
Sometimes there is a requirement to have multiple if statement embedded inside of each other. |
4 |
Switch Statement
Sometimes the nested if-else statement is so common and is used so
often that an easier statement was designed called the switch statement. |
5 |
Nested Switch Statement
It is also possible to have a nested set of switch statements. |
No comments:
Post a Comment