Boolean – Blonde Dictionary

The first time I heard the word “boolean” I didn’t even know what to associate it with. I guess the only thing that came to my mind was an image of someone shouting “boo” to scare me. But since I was doing a coding bootcamp at the time, I soon learned that they aren’t scary at all, in fact, they’re pretty simple!
The term comes from a branch of algebra called Boolean algebra, after its founder, George Boole (who would have turned 200 years old last Monday!). It basically means that any variable can only have two values: “true” or “false” – which are represented by “1” or “0”. You’ve probably heard about it, these variables are also called binary.

This is kind of what happens behind the scene with booleans
This is kind of what happens behind the scene with booleans

Alright, so what is a boolean in programming? It is a true or false condition that can be used to create an algorithm. A boolean can check whether required conditions are satisfied and direct the program, depending on the outcome.

A lot of coding academies use some sort of an age example to illustrate how booleans work. I have created my own, so here it is! (look for the “if” statement)

[Sorry, the program was lost between blog migrations from WordPress to Squarespace and then back to WordPress :/ ]

It is very simple, if you press the “start” button, it will ask for your age. You will need to type in a value and the program will check whether it is below 18 or not and will return a message. I used the example of purchasing alcohol since that is one of the most popular applications of filtering people by age.

It took me some time to figure out how to embed code into a WordPress post and I’ve finally managed it using the Code Embed plugin! But for some reason after you run the program, you get back to the home page and I don’t know how to change it 🙁 so please bear with me, I’m working on it! 🙂

So here’s the tiny program that will check if you’re over 18 (you can test different values):


Boolean logic goes further and includes Boolean operators (AND + OR), but I don’t want to go into details now because I’m not sure if I’ll be able to explain it well enough at this point 😉

<the blonde>


Share on linkedin
Share on facebook
Share on twitter
Share on pinterest

One Response

  1. Nice try, however the issue is you did not create a condition for the input values, which are not numerical. When I test using them, the program gives me a solution that I can enjoy my drink. For example I can type in “seven” and it will give me a result Enjoy your drink!. Think about how to fix this.On the other side, the code’s style is consistent. Which is always good.

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's be friends on Social Media:

Popular posts: