A short reminder of every operator and function on one page.
Pseudocode keywords for variables and constants
DECLARE <identifier> : <data type>
CONSTANT <identifier> ← <value>
Data types
INTEGER | REAL | CHAR | STRING | BOOLEAN |
|---|
Arithmetic
Comparison
Logical (Boolean)
String functions
LENGTH(s) | SUBSTRING(s, start, length) | UCASE(s) | LCASE(s) |
|---|
Common pseudocode pitfalls
- Single
= for equality in CIE pseudocode (not ==).
- Single quotes for
CHAR, double quotes for STRING.
← is the only operator; = means equality (comparison), so never use it to assign a value.
- are 1-indexed in CIE pseudocode (not 0-indexed like Python).
- Always declare a before using it, with the right data type.
- Use
MOD(a, b) for "is divisible by" rather than dividing and checking the fractional part.