Write Cambridge pseudocode for O Level 2210, IGCSE and AS and A Level 9618, run it, and dry-run it with a trace table. It runs in your browser, so nothing you type is sent anywhere.
| Variables | DECLARE Count : INTEGER Count ← 0 (type <-) CONSTANT Pi = 3.14 |
|---|---|
| Input and output | INPUT Name OUTPUT "Hello ", Name |
| Selection | IF ... THEN ... ELSE ... ENDIF CASE OF x ... OTHERWISE ... ENDCASE |
| Loops | FOR i ← 1 TO 10 STEP 2 ... NEXT i WHILE ... DO ... ENDWHILE REPEAT ... UNTIL ... |
| Arrays | DECLARE A : ARRAY[1:10] OF INTEGER DECLARE G : ARRAY[1:3,1:4] OF STRING |
| Subroutines | PROCEDURE P(BYREF x : INTEGER) ... ENDPROCEDURE FUNCTION F(a : INTEGER) RETURNS INTEGER ... RETURN ... ENDFUNCTION CALL P(x) |
| Records | TYPE Pupil ... DECLARE Name : STRING ... ENDTYPE Pupil.Name |
| Text files | OPENFILE "f.txt" FOR READ READFILE WRITEFILE CLOSEFILE EOF("f.txt") |
| Operators | + - * / ^ DIV MOD & = <> < > <= >= AND OR NOT |
| Functions | LENGTH LEFT RIGHT MID UCASE LCASE ASC CHR INT ROUND RAND SQRT ABS NUM_TO_STR STR_TO_NUM IS_NUM |
Press Run to execute your program.
Press Trace table to run your program step by step and see the value of every variable after each line.
Press Ctrl + Enter to run. Text files you create with OPENFILE last until you leave the page. Keywords must be written in capitals, and a value is given with ←, which you type as <-.