+ 1

How i can use if else if

7th Dec 2016, 9:27 PM
Amr Hendy
Amr Hendy - avatar
4 Answers
+ 3
It depends where to use but, the condition itself begins with if pay attention to indentation... for example if something is true: --do this--- elif something is true: --do this--- else: (else working when above statements are wrong or didn't executed in other words.) --do this-- The next way is using if -else condition statement in the if-else condition statement. so here: if something is true: if another thing is true: --- do this--- elif another thing is true: --do this--- else: -----do this- elif something is true: ...etc... going in this way, so if you pay attention to indentation you will understand Hope this is helpful.
8th Dec 2016, 1:43 AM
Murat Ahmedovich
Murat Ahmedovich - avatar
+ 2
Elif can be used to combine multiple if statements.
6th Jan 2017, 1:14 AM
Jay Schoenen
Jay Schoenen - avatar
+ 1
if (X = 1): print("yes, it is one.") elseif (X = 2): print("maybe") elseif (X = 3): print("no! You are wrong") Going further to explain: python language provides if and else for decision making as i just did above. If (so so and so is TRUE) then wash Hair. But if not TRUE, then don't wash Hair. Rather clean ROOM
7th Dec 2016, 9:36 PM
JENN
JENN - avatar
+ 1
elif, not elseif.
8th Dec 2016, 12:56 AM
aruluth
aruluth - avatar