+ 1

Can someone please explain the if elseif else statement?

Sorry I'm not understanding it.

4th Aug 2017, 11:58 PM
Aurora A
Aurora A - avatar
3 Respostas
+ 6
It is Simple english. If you have money, you will spend it on something, else you just sit and watch anime at home. In programming, if(money) { do(shopping); } else { watch(anime); } Remember, there should be a non-zero value inside if() to let it work, otherwise else will execute. Now, If consider you have so much money, you will buy a bike else if you've money but not enough to buy a bike, you will buy a shirt atleast, else you just sit at home and watch Naruto Shippudin. This is how if, else if and else works.
5th Aug 2017, 6:06 AM
Sachin Artani
Sachin Artani - avatar
+ 1
the if statement checks if a condition is true, if so executes q block of code, if not, goes to the else if, if there is one and does the same, checks the condition, if true executes the code, if not, goes to the else statement, if there is one. The else statement is executed only if the condition in the if and else if(s) are false e.g. if ( condition ) { //code executed if condition is true } else if ( condition2 ) { // executed id condition is false and condition2 is true } else { // executed if both conditions were false }
5th Aug 2017, 12:19 AM
voidneo
0
if mean True condition. else mean False condition. example:- $a=7; $b=5; now - if (a>b ) //this is true condition echo a; } else //this is False condition { echo b; /?>
5th Aug 2017, 1:13 AM
Irwin Lopez
Irwin Lopez - avatar