+ 1
does 'if' not check further if it got the first condition as true??
can anyone tell me .. I missed it in tutorials.. :(
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 :)
+ 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.