Types and constants · ประเภทและค่าคงที่
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
Six data types
- The 2026 guide uses
INTEGER,REAL,CHAR,STRING,BOOLEANandDATE. DATEis in this guide. It is not in the IGCSE 0478 syllabus for 2026–2028.- A paper that uses a date tells you the format, because dates are written differently around the world.
ไทย
ชนิดข้อมูลหกชนิด
- คู่มือปี 2026 ใช้
INTEGER,REAL,CHAR,STRING,BOOLEANและDATE DATEอยู่ในคู่มือนี้ แต่ไม่มีอยู่ในหลักสูตร IGCSE 0478 ปี 2026–2028- ข้อสอบที่ใช้วันที่จะบอกรูปแบบ给你的, เพราะวันที่เขียนแตกต่างกันไปในแต่ละประเทศ
DECLARE Name : STRING
DECLARE Done : BOOLEAN
DECLARE Birth : DATE
Name ← "Ada"
Done ← TRUE
OUTPUT Name
OUTPUT Done
English
CONSTANT uses =
- A constant is a name for a value that the program does not change.
- The guide writes
CONSTANT HourlyRate = 6.50— with=, not with the arrow. - Only a literal may stand on the right: a number, or text in quotes.
ไทย
CONSTANT ใช้ =
- Constant (ค่าคงที่) คือชื่อสำหรับค่าที่โปรแกรมไม่เปลี่ยนแปลง
- คู่มือเขียน
CONSTANT HourlyRate = 6.50— พร้อม=, ไม่ใช่พร้อมลูกศร - เฉพาะ literal เท่านั้นที่สามารถอยู่ทางขวา: จำนวน, หรือข้อความในเครื่องหมายคำพูด
CONSTANT PassMark = 50
OUTPUT PassMark
English
Watch out
- Variables are stored with
←. Constants are declared with=. - The guide's own date example is written
02/01/2005. On the paper, follow the format the question gives you.
ไทย
ระวัง
- ตัวแปรเก็บด้วย
←ค่าคงที่ Declare ด้วย= - ตัวอย่างวันที่ของคู่มือเขียนเป็น
02/01/2005ในข้อสอบ ให้ปฏิบัติตามรูปแบบที่โจทย์กำหนด
English
Common mistakes
BOOLEANvalues areTRUEandFALSE, in capitals.- A
CHARis one character in single quotes, such as'A'. ASTRINGuses double quotes.
ไทย
ข้อผิดพลาดที่พบบ่อย
- ค่า
BOOLEANเป็นTRUEและFALSE, ตัวพิมพ์ใหญ่ทั้งหมด - A
CHARเป็นหนึ่งตัวอักษรในเครื่องหมายอัญประกาศเดี่ยว เช่น'A'ASTRINGใช้เครื่องหมายอัญประกาศคู่
English
Now you try
- Declare a constant with
=and output it. - Text needs quotes:
"Ada", notAda.
ไทย
ลองดูเลย
- Declare ค่าคงที่ด้วย
=และแสดงผลมันออก - ข้อความต้องการเครื่องหมายคำพูด:
"Ada", ไม่ใช่Ada
Declare a constant PassMark equal to 50 and output it. Fill in the value on the CONSTANT line. · ประกาศค่าคงที่ PassMark เท่ากับ 50 และแสดงผลลัพธ์ เติมค่าลงในบรรทัด CONSTANT
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่
Output the word Ada in quotes, so the program prints Ada. · เอาต์พุตคำ Ada ในเครื่องหมายอัญลักษณ์, เพื่อให้โปรแกรมพิมพ์ Ada
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่
Declare Name as a STRING, store Ada, and output it. · ประกาศ Name เป็น STRING, เก็บ Ada, และเอาต์พุตมัน
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่