OUTPUT and sequence · เอาต์พุตและลำดับ
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.
ไทย
รหัสจำลองคือภาษาของข้อสอบ
- Cambridge International AS Computer Science 9618 เขียนอัลกอริทึมด้วย รหัสจำลอง (pseudocode)
- ใช้คู่มือสำหรับข้อสอบปี 2026 คู่มือสำหรับปี 2027, 2028 และ 2029 ใช้ไวยากรณ์เดียวกัน
- คำสั่งจะรันจาก บนลงล่าง ลำดับนี้เรียกว่า ลำดับ (sequence)
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. - Comment เริ่มต้นด้วย
//และต่อเนื่องไปจนจบบรรทัด
English
Now you try
- Type pseudocode in the box, then press Run.
- Press Check answer to test it.
ไทย
ลองดูเลย
- พิมพ์伪代码 (pseudocode) ลงในกล่อง แล้วกด Run
- กด Check answer เพื่อทดสอบ
Use OUTPUT to print the word Hello. · ใช้ OUTPUT เพื่อพิมพ์คำ Hello
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่
Print Red, Green and Blue, one per line, in that order. · พิมพ์ Red, Green และ Blue, แต่ละบรรทัดตามลำดับนั้น
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่
On one line, output You have , the number 3, then lives left. · บนบรรทัดเดียว, เอาต์พุต You have , จำนวน 3, แล้ว lives left
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่