Pseudocode 伪代码 is the language Cambridge writes algorithms 算法 in. It is not a real programming language — no computer runs it — but the exam marks it as if it were, so the form matters.
Every keyword 关键字 is written in upper case: IF, REPEAT, PROCEDURE, OUTPUT.
- 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.
伪代码(pseudocode)是剑桥书写算法(algorithm)所用的语言。它不是真正的编程语言——没有计算机会运行它——但考试按真代码来评分,所以书写形式很重要。
每个关键字(keyword)都用大写书写:IF、REPEAT、PROCEDURE、OUTPUT。
DECLARE Count : INTEGER
Count ← 3
IF Count > 0
THEN
OUTPUT "Ready"
ENDIF
- 写
IF,绝不写if或If。 - 关键字永远不能用作你自己的名字:不能把变量叫做
FOR。
常见错误
- 关键字用小写。评分方案要求大写。
- 自创关键字。只有本讲义中列出的词在考纲之内。