Pseudocode Sandbox
Write and run pseudocode to see how algorithms execute step-by-step. Watch the trace table update as your code runs!
Interactive Pseudocode Runner
Write pseudocode and see how it executes step-by-step
Code
Output
Output will appear here...
Trace Table
Run code to see trace table...
Syntax Reference
Variables
x = 5name = "Alice"Output
OUTPUT xOUTPUT "Hello"FOR Loop
FOR i = 1 TO 5 OUTPUT iNEXT iWHILE Loop
WHILE x < 10 x = x + 1ENDWHILEIF Statement
IF x > 5 THEN OUTPUT "Big"ELSE OUTPUT "Small"ENDIFOperators
+ - * / MOD= <> < > <= >=AND OR NOTTry These Examples
Sum 1 to 10:
total = 0
FOR i = 1 TO 10
total = total + i
NEXT i
OUTPUT total Even or Odd:
num = 7
IF num MOD 2 = 0 THEN
OUTPUT "Even"
ELSE
OUTPUT "Odd"
ENDIF Countdown:
n = 5
WHILE n > 0
OUTPUT n
n = n - 1
ENDWHILE
OUTPUT "Blast off!" Understanding Trace Tables
A trace table shows the values of variables at each step of program execution. They're essential for:
- ✓ Desk checking - manually testing your algorithm
- ✓ Finding errors - spotting where logic goes wrong
- ✓ Understanding loops - seeing how variables change each iteration
- ✓ Exam preparation - trace tables are commonly assessed!
Exam Tip
When completing trace tables in exams, always show the initial value of each variable and update the table every time a variable changes. Don't skip iterations in loops - markers want to see each step clearly documented.