0
Whats the different between if and elif?
4 Réponses
+ 8
When the 'if' condition fails the 'elif' is tested.
+ 3
you start a if statment with "if".
When your if statment has multiple cases you want to check then you can add "elif" after the first "if" (and every "elif" afterwards).
("elif" = else if)
the else statment can ve placed at the end of an if or elif statment and is executed if none of the previous condotions are met.
exemple:
x = 3
if x == 0:
print("case 0")
elif x > 0:
print("case 1")
else:
print("case 2")
0
No no,i mean what if i use if instead of using elif
0
I wrote the script but when i ran it, it has some issues, then i realized the elif,so i replace it with if,and the issues were done