Recap of Booleans
What We’ve Covered So Far
To declare a boolean:
1 |
bool meep; // makes a boolean variable named meep |
To declare a boolean with a value:
1 |
bool meep = true; |
1 2 3 |
meep = true; // or meep = false; |
1 2 3 4 |
blop = true; plerb != blop; // this sets plerb to false // or plerb = !blop; // this also sets plerb to false |
Questions and Activities to Try
1. Practice using boolean values- true/false, 1/0 and HIGH/LOW in conversation. When someone asks you a question and the answer is “yes” you can answer “true,” “one” or “high.” Just remember to switch back to regular ol’ yes and no once you’re done with this activity so people who don’t work with robots can understand you. If you want you can even add a weird robotic voice when you practice using boolean values.2. Think about things in your regular life that can have a boolean value. Here are a couple examples: A light being on or off, awake or not awake, and a coin being heads or tail. It’s actually kind of tough to think of boolean examples since they really need to be true or false. Questions such as, “is it hot out?” don’t have a yes or no answer since it starts to get hot slowly and you can’t really tell exactly when it got hot. Make a list of qualities or questions that are boolean and discuss them with others. Be prepared to defend your questions or qualities that people might not see as boolean.