+ 1
What the use of else if command?😕😕😕😕
3 Respuestas
+ 8
If the if statement above is false, this condition will be evaluated.
if (condition) {
// if this is true, do this
}
else if (condition) {
// ELSE (otherwise) do this
AKA: if the above was false, check if this was true. If this was true, do this
}
else {
// IF all were false, do this
}
+ 6
like what @Rrestoring faith stated.
Note that the codes in the conditions should output a boolean value.
+ 6
Else if is very useful in Python specifically (as elif)
It saves A TON of indentations.