What is Equality in Programming?
Equality is a key concept in computer science that helps computers make decisions by checking if two values are the same. In code, this is done using the Equality Operator—written as ==
. Think of it like a detective with two magnifying glasses, comparing what's on each side of the ==
. If they match, the result is TRUE
; if not, it’s FALSE
. These results—called Boolean values—help computers decide what to do next.
Where Students Use Equality in Kodable
Equality in Kodable Basics
Students explore equality in the Asteroid Belt course by deciding which key matches the tunnel door. If the key and lock are equal in color and shape, the door opens. If not, it stays shut. This teaches how Boolean logic helps control what happens in a program.
Students will:
Use the Equality Operator (
==
) to compare valuesMake decisions based on whether two values are the same
Example:
In this example, the fuzz is rolling through a maze and comes across two keys. To unlock the tunnel door and move forward, the fuzz needs to pick the key that matches the shape and color of the lock. This shows how computers use the equality operator (==
) to compare values and make decisions!
Why It Matters
Equality is a foundational concept that helps programmers:
Make decisions in their code
Compare values (like passwords, items, or player scores)
Control how their programs respond to different situations
When combined with Booleans and Conditional Statements, equality helps students build interactive, responsive programs.