How can I use two if ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I use two if ?

1st Aug 2018, 9:54 PM
Armann
Armann - avatar
3 Answers
+ 3
Do you need to use an if statement inside another if statement? Or one after the other? In the first case: if(condition): if(condition): else: This indentation must be followed. In the second case: You must use if.... elif/else if..... else if(condition1): ...... else if(condition2): ...... else(): ...... This indentation must be followed.
1st Aug 2018, 10:13 PM
Chandana Pasunooti
Chandana Pasunooti - avatar
+ 1
You can use else if statement and, yes, you can use two or multiples if
1st Aug 2018, 10:03 PM
Chalza
Chalza - avatar
0
Chandana Pasunooti I tried the first way (using two ifs) didn't work out , but second one is ok .👌
1st Aug 2018, 10:17 PM
Armann
Armann - avatar