Hello this is of nesting statements. It is possible to nest if-else else statements; this means you can use this means using functions one inside another.

 

 How to write a nested statement?

 

For example, the syntax is the following…

If (expression 1) {

  If(expression 2) {

   }

}

 

You can also nest an else if… else in a similar way as you nested the if statement.

 

This type of statement allows a choice to be made between two alternatives. A choice must be made between more than two possibilities. For example, the sign function in mathematics returns a negative number if an argument is less than zero, returns a positive number if the argument is more than zero.

 

I took this chart from http://www.programiz.com/sites/tutorial2program/files/flowchart-if-programming_0.jpg

 

That explains a process for an if statement that also can be used nested.

 This program shows an example on how to use a nested statement and how it works.

WATCH MY VIDEO https://youtu.be/hT153pKWogI

 

 

CC BY 4.0 #Mastery18 – Nesting of conditional statements by Ricardo Newton is licensed under a Creative Commons Attribution 4.0 International License.