#Mastery18 Nesting of conditional statements

The ifif...else and nested if...else statement are used to make one-time decisions in C++ Programming, that is, to execute some code/s and ignore some code/s depending upon the test condition. Without decision making, the program runs in similar way every time. 

The if statement checks whether the test condition is true or not. If the test condition is true, it executes the code/s inside the body of if statement. But it the test condition is false, it skips the code/s inside the body of if statement.

The if keyword is followed by test condition inside parenthesis ( ). If the test condition is true, the codes inside curly bracket is executed but if test condition is false, the codes inside curly bracket { } is skipped and control of program goes just below the body of if as shown in figure above.

I found the code shown in the picture in http://www.tutorialspoint.com/cplusplus/cpp_nested_if.htm and information in http://www.programiz.com/cpp-programming/if-else 

Just simple conditionals!

 

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

Comments are closed.