0
Why use elif if you can use if and get same result?
4 odpowiedzi
+ 3
To reduce the number of lines. when you use if and else only, multiple block of code has to be written comparing to use of if elif and else
0
it is kinda like if you like hotdogs, eat hotdogs, or if (elif) you like pizza or eat pizza or else (else) just eat burgers
0
else is a spare part which is run when if is not true
0
And if you use 'if' and not 'elif' program will check every 'if' statement for truth, and in 'elif' case iw will only check next only if previous was false - thus making less cpu and memory work, it's especially important while working with arrays and big data.