0

can anyone explain if... else if... else statement?

28th Oct 2016, 5:05 AM
urvish
2 odpowiedzi
+ 3
if (you have money) {you go to bar;} else if (you are in debt) {you sit at home;} else {you celebrate that you are finally out of debt and your balance is 0;}
29th Oct 2016, 12:53 AM
Eriks Karls
Eriks Karls - avatar
+ 1
if CONDITION1 {CODE1 here will be executing if condition1 is true and checking conditions will be stopped ,if condition1 is false ,then this code will be ignored and programm will check next condition2 } else if CONDITION2{CODE2 executing analogy to first case } else {CODE3 this code will be executing if neither condition is true }
28th Oct 2016, 12:29 PM
belka