ประกอบไปด้วย For..Do, While..Do และ Repeat..Until ดังนี้
| Statements | Syntax | Example |
|---|---|---|
| For..Do |
For i:={Start} to {End} do
{Statement};
For i:={Start} downto {End} do
{Statement};
|
For i:=1 to 10 do
writeln('i = ',i);
For i:=10 downto 1 do
writeln('i = ',i);
|
| While..Do |
While {Condition} do
{Statement};
| i:=0 While i<10 do i:=i+1; |
| Repeat..Until |
Repeat {Statement} until
{Condition};
| i:=0; Repeat i:=i+1 until i<10; |
จากตารางข้างบน เป็นรูปแบบ Loop ที่มี statement แค่บรรทัดเดียวต่อหนึ่ง condition เท่านั้น อย่างไรก็ตามหากมี statement หลายบรรทัด ต้องเติม begin .. end ด้วยทุกครั้ง ยกเว้น Repeat..Until Loop ดังนี้
หมายเหตุ - คำสั่งสุดท้ายของ Repeat ก่อนจะเข้าสู่ Until จะใส่เครื่องหมาย “;” ปิดท้ายหรือไม่ก็ได้