Member-only story
Truth Tables, Logic, and DeMorgan's Laws
Truth tables summarize how we combine two logical conditions based on AND, OR, and NOT. Logic tells us that if two things must be true in order to proceed, then both condition_1 AND condition_2 must be true. If it only takes one out of two things to be true, then condition_1 OR condition_2 must be true. DeMorgan’s Laws tell us how to negate a boolean expression and what it means to do so.
Truth Values in a computer:
Booleans At the end of the day, one of the few things, and most powerful things, a computer can determine is if a statement (expression) is "true" or "false." Because true and false are so prevalent in decision-making, they are their own keywords. In other words, in a program we write true, not the string 'true.'
Logical Operators: AND, OR, and NOT
We can combine several "boolean" statements that have true/false meaning into a single statement using the key concepts AND and OR (and NOT). If I want to go to the movie AND I have enough money, then I will go to the movie. BOTH conditions have to evaluate to true (have to be true) before the entire expression is true.