OUTPUT and sequence · OUTPUT 与顺序
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Pseudocode is the exam's language
- Cambridge International AS Computer Science 9618 writes algorithms in pseudocode.
- Use the guide for exams in 2026. The guide for 2027, 2028 and 2029 uses the same syntax.
- Statements run from top to bottom. That order is sequence.
中文
伪代码是考试的语言
- 剑桥国际 AS 计算机科学 9618 用伪代码写算法。
- 2026 年考试使用这份指南。2027、2028 与 2029 年的指南使用同一套语法。
- 语句从上到下运行。这种顺序就是顺序结构。
OUTPUT "Wake up"
OUTPUT "Brush teeth"
OUTPUT "Go to school"
Explore · 探索
One line after another · 一行接着一行
Pseudocode runs top to bottom — each line after the one above it. · 伪代码从上到下运行 —— 每一行接在上一行之后。
English
OUTPUT shows a value
OUTPUTdisplays a value. Text goes in double quotes.- Each
OUTPUTstarts a new line. - Several values, separated by commas, print on one line.
中文
OUTPUT 显示一个值
OUTPUT显示一个值。文字放在双引号里。- 每个
OUTPUT另起一行。 - 几个值用逗号隔开,印在同一行。
OUTPUT "Hello, world!"
OUTPUT "You have ", 3, " lives left"
English
Watch out
- Keywords are capitals:
OUTPUT, notprint. - A comma keeps values on one line. A new
OUTPUTstarts the next line. - Joining two strings with
&is taught with the string functions.
中文
注意
- 关键字用大写:
OUTPUT,不是print。 - 逗号把几个值留在同一行。新的
OUTPUT才换行。 - 用
&连接两个字符串,放在字符串函数那一课。
English
Common mistakes
- Text needs quotes. A number does not:
OUTPUT 42. - Comments start with
//and run to the end of the line.
中文
常见错误
- 文字需要引号。数字不需要:
OUTPUT 42。 - 注释以
//开头,一直到这一行结束。
English
Now you try
- Type pseudocode in the box, then press Run.
- Press Check answer to test it.
中文
现在你来试
- 在框里写下伪代码,然后按运行。
- 按检查答案来测试。
Use OUTPUT to print the word Hello. · 用 OUTPUT 打印单词 Hello。
Click Run to see the output here. · 点击“运行”查看此处输出。
Print Red, Green and Blue, one per line, in that order. · 按顺序打印 Red、Green、Blue,每行一个。
Click Run to see the output here. · 点击“运行”查看此处输出。
On one line, output You have , the number 3, then lives left. · 在一行里输出 You have 、数字 3,再接 lives left。
Click Run to see the output here. · 点击“运行”查看此处输出。