Master Pseudocode with Pro
Get unlimited access to the AI Tutor, Code Generator, and Converters. Plus, enjoy an ad-free experience.
Relational (Comparison) Operators in Pseudocode
Algorithms must evaluate data in order to make decisions. To do this, they rely on Relational Operators (frequently referred to as Comparison Operators).
These operators evaluate two separate values and ask a question: Is this side greater than that side? Are they exactly equal? The result of this evaluation is always a BOOLEAN value so it resolves strictly to either TRUE or FALSE.
While the logic is universal, the exact symbols used (especially for equality and inequality) are a major source of lost marks in exams. In this guide, we'll break down the concepts and explicitly define the syntax required by AQA, OCR, and Cambridge (CIE).
Table of Contents
Core Concepts: Comparing Data
Relational operators are the engine inside IF statements and WHILE loops. Without them, your program's flow could never branch or terminate based on user input.
Standard Comparisons
The most basic relational operators determine magnitude (which side is bigger).
| Meaning | Symbol | Example | Result |
|---|---|---|---|
| Greater than | > | 10 > 5 | TRUE |
| Less than | < | 10 < 5 | FALSE |
| Greater than or equal to | >= | 5 >= 5 | TRUE |
| Less than or equal to | <= | 4 <= 10 | TRUE |
The Danger: Equality vs Assignment
The biggest mistake programmers make is confusing the operator that checks if a value is the same (Equality) with the operator that forces a value to be the same (Assignment).
For example, score = 100 inside an IF statement might act as a comparison (asking "Is the score 100?"), but in other contexts or languages, it assigns the score variable to 100. This is why board-specific syntax is critical.
Syntax Variations by Exam Board
Exam boards mitigate the equality vs assignment danger in different ways. Some use arrows for assignment to free up the equals sign, while others use double equals signs.
AQA Pseudocode Standard
AQA avoids confusion by using the arrow ← exclusively for assignment. This means the standard equals sign is strictly a relational operator.
- Equality: Uses a single equals sign
=(e.g.,IF score = 10 THEN). - Not Equal: Uses the strict inequality symbol
≠in official papers. However, writing!=or<>is usually accepted in written exams.
OCR Pseudocode Standard
OCR's syntax mimics Python. It uses a single equals for assignment, meaning it must use a double equals for comparison.
- Equality: Uses a double equals sign
==(e.g.,if entry == "A" then). - Not Equal: Uses an exclamation mark and equals sign
!=.
Cambridge (CIE / 9618) Standard
Like AQA, CIE uses the assignment arrow ←, freeing up the single equals sign for logic statements. For "not equal", it uses the classic visual basic diamond brackets.
- Equality: Uses a single equals sign
=. - Not Equal: Specifically uses the diamond brackets
<>.
Conclusion
Relational operators are the core of decision-making algorithms. Whenever you write an IF statement, you are relying on a relational operator to resolve a query to TRUE or FALSE.
In exam conditions, the single most critical thing to remember is your board's "Equality" and "Not Equal" syntax. Mixing up ==, =, and <> is incredibly common, so memorize your specification's preference!
Ready to practice? Try our editor.
Give our pseudocode editor a go today for free - with a built-in compiler, tools to convert pseudocode to code, and project saving, PseudoEditor makes writing pseudocode easier than ever!
Start coding now