0
false && false is false?
I don't think so guys
8 Respostas
+ 13
--- AND ---
false && false: false
false && true: false
true && false: false
true && true: true
--- OR ---
false || false: false
false || true: true
true || false: true
true || true: true
--- NOT ---
!false: true
!true: false
Source: http://stackoverflow.com/questions/7583853/true-and-false-for-logic-and-logic-table
+ 11
My teacher taught me this some years back.
2 lies (2 falses) make 1 big lie (false) but not a truth.
+ 8
false && false = false
only
true && true = true
+ 5
Let us do little maths and assign 1 to 'true' and 0 to 'false'
&& (and) operation is equivalent to the product of numbers hence
false && false = 0 X 0 = 0 = false.
Isn't simple
+ 4
AND (&&)
-> if any is FALSE then result is FALSE
-> therefore, all must be TRUE for result to be TRUE
OR (||)
-> if any is TRUE then result is TRUE
-> all must be FALSE for result to be FALSE
NOT (!)
-> reverts the value, eg. not FALSE is TRUE and not TRUE is FALSE
Priority order of evaluation: NOT, AND, OR eg:
-> NOT FALSE || TRUE && FALSE => TRUE
-> order of eval. can be changed with "()", eg:
-> NOT (FALSE || TRUE) && FALSE => FALSE
it makes sense if you think logically, to get TRUE
-> with AND, *all* conditions must be TRUE
-> but with OR, *any* can be TRUE
maybe I'm biased by experience, i don't know, but don't worry about it, soon it will come to you as natural as 1+1.
hope it helps
+ 3
Just to complete the previous answers: && (there're two &s here) acts as a shortcut operator, meaning that when you type a&&b, "a" is evaluated first, and if it's false, "b" is not evaluated and the whole condition is false. So strictly speaking, false&&false is false because of the first false (the one at the left of &&).
https://msdn.microsoft.com/en-us/library/2a723cdk.aspx
+ 1
okay,
I studied digital logics,
I guess that's where I got the idea from,
0
true