Added Nested case and updated ElseIf statement. (#18465)
Added the nested If/Else case. Added the missing condition if ElseIf block.
This commit is contained in:
committed by
Quincy Larson
parent
3672dceffe
commit
7121f8ca41
@ -27,17 +27,40 @@ If/Else is a conditional statement where depending on the truthiness of a condit
|
|||||||
~~~~
|
~~~~
|
||||||
## If/Elseif/Else Statement
|
## If/Elseif/Else Statement
|
||||||
~~~~
|
~~~~
|
||||||
if (condition){
|
if (condition1){
|
||||||
statement1;
|
statement1;
|
||||||
statement2;
|
statement2;
|
||||||
}
|
}
|
||||||
elseif{
|
elseif (condition2){
|
||||||
statement3;
|
statement3;
|
||||||
statement4;
|
statement4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
statement5;
|
statement5;
|
||||||
~~~~
|
~~~~
|
||||||
|
## Nested If/Else Statement
|
||||||
|
~~~~
|
||||||
|
if (condition1){
|
||||||
|
if (condition2){
|
||||||
|
statement1;
|
||||||
|
statement2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
statement3;
|
||||||
|
statement4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (condition3){
|
||||||
|
statement5;
|
||||||
|
statement6;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
statement7;
|
||||||
|
statement8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~~~~
|
||||||
|
|
||||||
For more information check out the following link:
|
For more information check out the following link:
|
||||||
<a href='http://php.net/manual/en/control-structures.elseif.php' target='_blank' rel='nofollow'>PHP Else</a>
|
<a href='http://php.net/manual/en/control-structures.elseif.php' target='_blank' rel='nofollow'>PHP Else</a>
|
||||||
|
Reference in New Issue
Block a user