+ 1

What is the difference between nested if else and elseif statement in c++

10th Sep 2016, 10:43 AM
Dinesh
1 Answer
+ 2
Nested if: if (condition1) { if (condition2) { do_stuff(); } } Else if: if (condition1) { } else if (condition2) { do_stuff(); } In the first case, you do_stuff() when both condition1 and condition2 are true. In the second case, you do_stuff() when condition1 is false and condition2 is true.
10th Sep 2016, 10:48 AM
Zen
Zen - avatar