- 2

If else

If is false we write code or not

10th Dec 2020, 6:13 AM
Shaik Shabeera Begum
Shaik Shabeera Begum - avatar
2 Respuestas
+ 2
Depends on you. x = 1 + 1 if x == 1: print("1") >>> No output. - - - - - - - - - - - - - - - - y = 1 + 1 if y == 1: print("1") else: print("Others") >>> Others
10th Dec 2020, 6:19 AM
noteve
noteve - avatar
+ 1
Shaik Shabeera Begum Doesn't matter. We should write because everytime you can't get false. Example: int a = 10; int b = 20; if (a > b) here a > b returns false but it's not necessary that everytime a will be greater than b.
10th Dec 2020, 6:16 AM
A͢J
A͢J - avatar