+ 1
What is the difference between nested if else and elseif statement in c++
1 Antwort
+ 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.