does 'if' not check further if it got the first condition as true?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

does 'if' not check further if it got the first condition as true??

can anyone tell me .. I missed it in tutorials.. :(

8th Jul 2016, 5:00 AM
Alok Kushwaha
Alok Kushwaha - avatar
2 Answers
+ 2
if you use just one if like if x<5 : print ("x is smaller than 5") else: print ("x is bigger than 5") yes if the statment is true the it will apply the condition and will not see the else condition but if you use chain of if like if x<5 : if y<3: if z=5: print ("ok") else: print ("try again") then it will check till one of these if are not true to check else condition must be one of the three if are not true to go to else that what i understand from if condition wish i help U :)
8th Jul 2016, 2:32 PM
Ahmed Kamal
Ahmed Kamal - avatar
+ 1
Yes, if the first condition is true, then it will not check the elif statements. But it will check the next if statement, if that is what you meant.
8th Jul 2016, 5:18 AM
Gershon Fosu
Gershon Fosu - avatar