esse quam videri
Jump to: navigation, search


A variable having two possible values called “true” and “false.” It can be thought of as a binary value.

What does this mean

Similar to how Base 2 operates, Boolean also can only exist in 2 states, either 0 or 1. But in computer programming, we don't do any calculations with boolean. We simply tell the computer whether an element or condition is true or false.



A boolean is a data type intended to represent the two truth values of logic and Boolean algebra.

In programming and coding, you can create your own boolean variable and set it to true or false by saying “bool (nameOfYourVariable) = true;”

Boolean variables can be named with words and phrases that relate to a true/false conditional statement, such as “is,” “has,” etc.



Here’s an example related to pizza:

bool tastesGood = true;
bool isCheesy = false;
bool hasTomatoes = true;

Booleans are typically used for conditional statements!

if(tastesGood == true)
    bool customerSatisfied = true;


Although it would be intuitive for a boolean to be a bit in size, booleans are really one byte in size. This is due to how computers access memory.


See also

External Links