Pseudocode 伪代码 is the language Cambridge writes algorithms 算法 in. It describes algorithms without requiring a general-purpose programming language. This site interprets a defined Cambridge-style subset so you can run examples; an exam answer should follow the notation specified for that paper.
Every keyword 关键字 is written in upper case: IF, REPEAT, PROCEDURE, OUTPUT.
DECLARE Count : INTEGER
Count ← 3
IF Count > 0
THEN
OUTPUT "Ready"
ENDIF
- Write
IF, neveriforIf. - A keyword can never be used as a name of your own: you may not call a variable
FOR.
Common mistakes
- Lower-case keywords. The mark scheme expects upper case.
- Inventing keywords. Only the words in this handout are in the syllabus.