I have some trouble with logical clauses | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I have some trouble with logical clauses

i dont understand why the expression (1||0) is true. it just doesn't make sense, numbers shouldnt have a Boolean value.

13th Jan 2017, 1:39 PM
infinity
infinity - avatar
5 Answers
+ 6
1 == true 0 == false (1||0) == (true||false)
13th Jan 2017, 1:47 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
^_^
13th Jan 2017, 2:30 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
jesus christ valentine you're everywhere XD how do you find the time to answer every single question?
13th Jan 2017, 1:57 PM
infinity
infinity - avatar
+ 3
yeah he is really a hacker mind XD
13th Jan 2017, 2:30 PM
I Am a Baked Potato
I Am a Baked Potato - avatar
+ 2
guess what, back then when C was created it had no boolean values. This was only represented by numbers. But let's guess that you still don't get why boolean is represented by numbers, let's go lower, to processor level. Processor understands ONLY 1 (there is something - true) and 0 (there is nothing- false).
13th Jan 2017, 1:49 PM
Jakub Stasiak
Jakub Stasiak - avatar