# Comparison Operator

> A sign like ==, > or != that compares two values and answers true or false.

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** Relational Operator

## Think of it like

Think of it like a kitchen scale with two pans. It tells you which side is heavier, or if they match.

## Definition

A comparison operator checks two values and answers true or false. == asks if two values are equal and != asks if they differ. > and < ask which is bigger, and >= and <= allow a tie. The answer is always a boolean. Ifs and loops use these answers to decide what to do.

## Example

A cinema site checks age >= 13 before it shows a teen film. Jack is 12, so the answer is False.

## Example code

```python
>>> age = 12
>>> age >= 13
False
>>> age == 12
True
```

Two questions about one age, and two true or false answers.

## Why it matters

Every decision in code starts with a comparison. They are the questions an if asks.

## Common mistake

Writing = when you mean ==. One = stores a value; two of them compare.

## Three principles

- **Two values in.** It looks at a left and a right.
- **True or false out.** The answer is always a boolean.
- **Two equals signs.** == compares; = stores.

## Related terms

- [Operator](https://learn.benibix.com/term/development/operator)
- [Boolean](https://learn.benibix.com/term/development/boolean)
- [Assignment](https://learn.benibix.com/term/development/assignment)
- [Conditional Statement](https://learn.benibix.com/term/development/conditional-statement)

## Taught in

- [Operators in Python](https://learn.benibix.com/learn/development-concepts/operators-in-python): Programming Basics, 9/18

---

Source: https://learn.benibix.com/term/development/comparison-operator
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
