recipes · recipe ·

Repeat without copying lines

Use a loop to count and draw repeated behavior.

cpurecipe

If your planet has ten animals, you should not need ten copies of the same instruction. A loop repeats a block and gives each repetition a value to work with. This range loop starts i at zero and continues while i is less than four. That gives four visits: zero, one, two, and three. Zero is a very common starting point in code.

start.yh

Status: complete-program

Repeat without copying lines

Use a loop to count and draw repeated behavior.

cpu · type checked

for i from 0 < 4
{
    Console.Log("Crystal " + Text.From(i))
}
project.mech
manifestVersion = "2"
package = "api.example.recipe__loops"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
Crystal 0
Crystal 1
Crystal 2
Crystal 3
Notes and source

Make six crystal messages. Then start at one and include six. Compare the count with the numbers printed.

demonhunterlabs/app/lib/yeho-walkthrough.ts