Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Loops: while, for, and accumulation · ⁨Loops: while, for, และการสะสม⁩

English

Repeating work

  • A loop runs the same block of code many times, so you don't copy it by hand.
  • C has three loops: while, for, and do-while. They all repeat while a condition is true.
  • The condition is checked each time around. When it becomes false, the loop stops.
ไทย

การทำงานซ้ำๆ

  • ลูป จะรันบล็อกโค้ดเดียวกันหลายครั้ง ดังนั้นคุณไม่จำเป็นต้องคัดลอกมันเอง
  • C มีลูปสามแบบ: while, for และ do-while ทั้งสามจะทำซ้ำจนกว่า เงื่อนไข จะเป็นจริง
  • เงื่อนไขจะถูกตรวจสอบทุกครั้งเมื่อวนรอบ เมื่อเป็นเท็จ ลูปจะหยุดลง

Handout · ⁨เอกสารประกอบการเรียน⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP