0
Elif statements are confusing me
Hello, I'm a beginner coder just to start. I understand that elif (in python) is simply a shortcut instead of using multiple if and else statements. For some reason, my mind is not wrapping around this concept. I feel that elif statements are simply saying if statements without saying the else part, if that makes any sense. Would someone be kind enough to explain elif statements in more simple terms with an example possibly? Thank you.
1 ответ
+ 1
if Condition :
// do if
else :
//else part
if condition :
//do if
else :
//do else
.....
.....
Can be done same as:
if Condition :
// do if
elif condition :
//do if
else :
//do else
elif reas as just else if (just one more if starts, in else part).