Guide

Step By Step

❌ The Boolean Type ✔️

Boolean?

I know. It sounds scary!

What is this thing ? Boolean types? I heard about Boolean Algebra, but I'm so bad at math! Run!!! 🤾‍♀

Well... first of all, drama much?

Second, Boolean types are the most simple thing you will ever see. Why? Because it only has two values:

  • True ✔️
  • False ❌

These are called Truth Values.

This is how the standard Library defines the Boolean type.

The computer is full of switches that can be On (True) or Off (False) and if you list the switches (transistors, if you ever heard about those) in order and apply a certain combination of ON/OFF, it will perform a task (by turning on other transistors automatically). As an example, it may turn on the LEDs on your screen showing a picture.

This combination of On/Off it's a little tedious to write, so the early computer scientists started using the two symbols 1/0.

This is the famous binary code.

All you need to know about Boolean Algebra (the rules of True and False values) is in the table on top. Really.

If it helps, you can read A as "I am an Astronaut" and B as "My name is Bob".

The A, B values can combine 1/0 in the ways in the table, if we apply the three connectors and, or, not then we get the outputs that correspond. They produce a new Truth Value to the combination of statements.

Everything else is a combination of those three rules.

So, if I say "I am an Astronaut, or my name is Not Bob", is it true? By the way... my name is Julio. Also, I am not (yet) an astronaut. 👨‍🚀

And and Or are functional connectors for the sentences.

So, let's check in Ada!

This really puts in perspective how people phrase their sentences, right?