| the OR operator
Think of it as an OR in a sentence. Is this sentence true: My name is Joshua OR I have never seen a computer.
The sentence is still true because I said OR and had a true statement.
A B A|Bfalse false false
true false true
false true true
true true true
As seen in the table above, the only way to make an or statement false is that if both statements are false.
& the AND operator
Just like OR but using the word AND. Is this sentence true: My name is Joshua AND I have never seen a computer. This sentence is obviously false because the second statement is false.
A B A&B
false false false
true false false
false true false
true true true^ the XOR operator
XOR or EXCLUSIVE OR means if ONE and ONLY ONE is true, the sentence is true. Since XOR doesn't equate to any english metaphor, I'll just post the table.
A B A^B
false false false
true false true
false true true
true true false! the NOT operator
The easiest to learn. NOT just switches the boolean. !true = false. !false=true.
== the EQUAL TO operator
Similarly easy, EQUAL TO just checks if either side is equal.
This works with number, strings, objects, anything.!= the NOT EQUAL TO operator
Just like equals, but NOT. Checks if the two ARENT equal.
The complete table:
A B A|B A&B A^B !A false false false false false true true false true false true false false true true false true true true true true true false false
This and others like it have been brought to you by the Josh Cannon foundation.
No comments:
Post a Comment