IB Computer Science Pseudocode Rules
This page outlines the official pseudocode conversion rules for the IB Computer Science curriculum.
Refer to these guidelines when converting Python code to IB standard pseudocode.
Reference: IB Official Pseudocode Rules (PDF)
🔹 IB Computer Science Official Pseudocode Conversion Rules
Basic Syntax
Python | IB Pseudocode |
---|---|
# comment | // comment |
x = 5 | x ← 5 |
print(x, y) | OUTPUT x , y |
x = input() | INPUT x |
A[0] | A[0] // arrays are 0-indexed |
Control Structures
Python | IB Pseudocode |
---|---|
if x == 0: | IF x = 0 THEN |
elif x == 1: | ELSE IF x = 1 THEN |
else: | ELSE |
for i in range(1, 6): | loop i from 1 to 5 |
while x < 10: | WHILE x < 10 DO |
def add(a, b): | FUNCTION add(a , b) |
repeat ... | loop … UNTIL condition |
match / case | CASE OF … END CASE |
Operators
Python | IB Pseudocode |
---|---|
a // b | a div b |
a % b | a mod b |
and, or, not | AND , OR , NOT |
== , != | = , ≠ |
< , <= , > , >= | < , ≤ , > , ≥ |
+= , -= , *= , /= | ← x + … |
Block Terminators
Python | IB Pseudocode |
---|---|
# end if | END IF |
# end for | end loop / END FOR |
# end while | END WHILE |
# end function | END FUNCTION |
# end case | END CASE |
# end procedure | END PROCEDURE |