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

PythonIB Pseudocode
# comment// comment
x = 5x ← 5
print(x, y)OUTPUT x , y
x = input()INPUT x
A[0]A[0] // arrays are 0-indexed

Control Structures

PythonIB 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 / caseCASE OF … END CASE

Operators

PythonIB Pseudocode
a // ba div b
a % ba mod b
and, or, notAND , OR , NOT
== , !== , ≠
< , <= , > , >=< , ≤ , > , ≥
+= , -= , *= , /=← x + …

Block Terminators

PythonIB Pseudocode
# end ifEND IF
# end forend loop / END FOR
# end whileEND WHILE
# end functionEND FUNCTION
# end caseEND CASE
# end procedureEND PROCEDURE