OCR Pseudocode Editor & Runner
Write OCR Exam Reference Language, run it right in your browser, and step through every line while you watch the variables change.
What is pseudocode?
Pseudocode is a plain-language way of writing out the logic of a program before you write real code. It uses structured keywords — IF, FOR, WHILE, PROCEDURE — so the steps are unambiguous, but it drops the fiddly syntax of a specific programming language. That makes it perfect for planning algorithms, studying for exams, and explaining ideas.
This editor follows the OCR GCSE Exam Reference Language (ERL): = assignment, print() and input(), if/elseif/else, for…next, while…endwhile, do…until, switch/case/default, and procedure/function blocks with return. Press Run to see the output, then step through one line at a time.
OCR pseudocode syntax at a glance
| Construct | Syntax | Example |
|---|---|---|
| Assignment | x = value | total = 0 |
| Output | print(expr) | print("Total: " + str(total)) |
| Input | x = input(prompt) | name = input("Name?") |
| Selection (if / else) | if … then … else … endif | if n > 5 then … endif |
| Multi-way selection | switch x: case v: … default: … endswitch | switch day: case "Sat": … endswitch |
| Count-controlled loop | for i = a to b … next i | for i = 1 to 10 … next i |
| Pre-condition loop | while cond … endwhile | while n > 0 … endwhile |
| Post-condition loop | do … until cond | do … until n == 0 |
| Procedure / subroutine | procedure name(params) … endprocedure | greet("Ada") |
| Function that returns a value | function name(params) … return … endfunction | return n * 2 |
| Comment | // comment | // swap the values |
See these algorithms animated
Pseudocode FAQ
What is pseudocode?
Pseudocode is a plain-language way of describing the steps of an algorithm, using structured keywords like IF, FOR and WHILE without the strict syntax of a real programming language. It lets you plan and communicate logic before writing code.
What is OCR Exam Reference Language?
OCR Exam Reference Language (ERL) is the defined pseudocode used in OCR GCSE Computer Science (J277) exam papers. It looks close to Python — x = 5, print("hi"), input() — but with explicit block ends like endif, endwhile and endprocedure.
Is the pseudocode editor free?
Yes. The pseudocode editor and runner are completely free, run in your browser, and need no sign-up or installation.