The last type we’re going to look at is ‘bool’.
Short for “boolean”, bools are either true or false.
Why ‘bool’? Well, they’re named after this guy, George Boole:
Here are some examples of bool variables:
bool variables seem pretty simple at first, but it turns out that they play a really important role in code. Think about the last time you logged into a website, and got your username or password wrong. Somewhere in that website code, there must have been code that was checking whether your password was correct. If your password is correct, you would log in. If it wasn’t correct, you’d see some kind of error message. That sort of logic where one of two things can happen is called control flow, and it’s controlled by bool values internally.
Basically, bool values are used to control the flow of your code, and determine which code will run.
We’ll get into that soon!