Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Count Range Counter Loop
Count sequentially through an inclusive numeric range from start to finish.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Control Flow). Copy the parameterized template or run the self-contained example.
- 1Category: Control Flow
- 2Attribution: Otter Core Language Spec (D5)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
count from ${start} to ${finish} as ${number}
say ${number}
.
sum is 0
count from 1 to 5 as n
say "Counting:" n
sum is sum plus n
.
if sum is not 15
fail with "count-range sum mismatch: expected 15"
.
Installation & Usage
otter snippet inspect cf-count-range
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.