Below are truth tables for both true and false and for 0 and 1 values.
Overview of Truth Tables
Truth logic tables are tables that compare true and false values. In the tables above, p and q are the variables. True, false, 0, and 1 are the values for p and q.
The reason why we show you the bit tables is because computers see true and false as 0 and 1. Now, 0 and 1 are also known as bits. A bit is either 0 or 1.
Special Truth Table Techniques
Take a look at the last part of the above table. If you multiply p and q, you get the same results as p “And” q. And, if you add p and q, you get the same results as p “Or” q.
A Different Story with Xor
Unfortunately, Xor is a different case. Basically, Xor says, if p and q are the same, then the result is false or 0.
Logical Functions Tool
Use the tool below to test logic results for 0 and 1. For the purpose of making it easier to read, we use true and false as result values.
Try This Out
Open up a spreadsheet that allows you to use the three operators: And, Or, and Xor. Then, try out these functions:
Although using 0 and 1 is quicker than using true and false, it is also more symbolic. However, it is better to use the words true and false as logical values, especially when coding.
For more information on logic tables, check out the links below.