+ 3

Boolean logic

What is a wanted a false statement to execute a task how would i go about that? Like if (2==3) Print(“hello”)

22nd Feb 2018, 10:35 PM
Sulaiman Bada
Sulaiman Bada - avatar
4 ответов
+ 5
Maybe I'm miss-reading the question but, the condition isn't really false if you use the not operator. It is still true (NOT false). You would need to use an else statement to assure a different path is taken when the condition is false. if (2 == 3) print("Hello") else print("Not equal!") Output: Not equal! 2 == 3 is false, so the else statement executes which prints 'Not equal!'.
23rd Feb 2018, 1:36 AM
Rrestoring faith
Rrestoring faith - avatar
+ 6
Try using the not (!) operator, like this: if (!(2==3)){ print("Hello") }
22nd Feb 2018, 10:50 PM
DaemonThread
DaemonThread - avatar
+ 6
to decide weather true or false it should have condition like if not true: # becoze no condition not going to print print ("true 0") elif (2+2<5): #this will print becoze condition print("true 1") else: # this will not print becoze first elif was right print("true 2")
23rd Feb 2018, 5:47 PM
Yash🏁🔘
Yash🏁🔘 - avatar
+ 5
if 2 != 3: print("hello")
22nd Feb 2018, 10:52 PM
LordHill
LordHill - avatar