+ 1

What the use of else if command?😕😕😕😕

19th Aug 2017, 4:05 PM
Rishi Mandal
Rishi Mandal - avatar
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 }
19th Aug 2017, 4:09 PM
Rrestoring faith
Rrestoring faith - avatar
+ 6
like what @Rrestoring faith stated. Note that the codes in the conditions should output a boolean value.
19th Aug 2017, 5:24 PM
Wen Qin
Wen Qin - avatar
+ 6
Else if is very useful in Python specifically (as elif) It saves A TON of indentations.
20th Aug 2017, 11:27 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar