Last time, we introduced control structures and mentioned if
statements. These help our programs make decisions by running code only when something specific is true.
Engagement Message
Ready to explore how the program knows if something is true?
That "something specific" is called a condition. Think of it as a question that must have a clear "yes" or "no" answer. In programming terms, these answers are True
or False
.
Engagement Message
Does this idea of a true/false question feel familiar?
These special True
and False
values are called Booleans. Every condition inside an if
statement evaluates to one of these two Boolean values. It's either True
, or it's False
.
Engagement Message
Simple binary choice, right?
So how do we form these conditions? Often, we use comparison operators to compare values. For instance, we can check if a score is greater than 100 (>
) or if a name is "Admin" ().
