0
elif
Basic question here, I'm currently on boolean- logic chapter and going over "and, or, not" and I noticed that when typing code certain codes will pull a syntax error if an "elif" is not used rather than a "if,else". So when do I know when to use "elif" rather then just waiting for an error?
2 Réponses
+ 5
elif is used when you already have an if . think about elif as a special else.
And you cant have an else without a if
0
You must use "if" first, if the condition is false you can set another condition using "elif". But remember "if" always comes first.