Overview - Relational operators
What is it?
Relational operators are symbols used to compare two values. They check if one value is equal to, not equal to, greater than, less than, or in between compared to another value. The result of these comparisons is always a boolean: true or false. These operators help programs make decisions based on conditions.
Why it matters
Without relational operators, programs couldn't compare values or make choices. Imagine a traffic light system that can't tell if a car is waiting or not, or a game that can't check if a player scored enough points to win. Relational operators let programs understand relationships between data, enabling logic and control flow.
Where it fits
Before learning relational operators, you should understand basic data types like numbers and booleans. After mastering them, you will learn about conditional statements like if-else and loops, which use relational operators to decide what code to run.