What is Equality in Programming?
Written by Jon Mattingly
Updated over a week ago

## Where to find Boolean practice in the game:

Learners are introduced to the concept of Equality in the Asteroid Belt.

## Definition:

In programming, when two things have the same value, it's called Equality. Equality in code is shown with a double-equal sign known as the Equality Operator. It's sort of like a detective who works double-time to check whether the value of the thing on the left side of the double equal sign is the same as the value on the right.

Once the operator does its check, it will return a value of TRUE or FALSE. If the values are equal, then the result is TRUE. If the values are not equal, then the result is FALSE. True and False are boolean values, and a computer uses Booleans to help make decisions about what to do next.

## Example:

Think about a computer program that controls whether or not you can unlock a smart phone. The program likely says something like "If you enter the correct password, then you can log in." This is a conditional statement! You can only log in if the condition (enter password correctly) is true.

So how does your device know if a password attempt is correct? When you type in your password, the program will compare it with your stored password using the trusted equality operator. The operator will check to see if the two values are equal. If the entered password and the stored password are NOT equal, then the result is FALSE and you can't log in. But, if the operator finds that the two values ARE equal, then the result TRUE and in you go!

Equality, Booleans, and Conditions all work together to control how a program behaves when certain things can happen.

## Application

In Kodable, we want our fuzz to roll the end of the maze. In Equality levels, there will be a tunnel locking the path, and learners need to find right key that will open the tunnel door. Code your fuzz to collect the key that is equal in shape and color to the key hole on the tunnel.

If the key and tunnel values are not equal, the tunnel door stays closed. If the key and tunnel are equal, then then the tunnel door opens and the fuzz can roll through!