for
Numeric loop (end INCLUSIVE).
Syntax
for i := start to end do ...
Description
for i := 1 to 5 → from 1 to 5 (5 inclusive). Use downto for counting down.
Example
Loading editor…
Expected output
1 2 3
When to use?
Known repetition.
Common mistakes
- ⚠️ for i := 1 to 5 → the end value 5 IS INCLUDED.