Skip to main content

repeat … times as

A counted loop with a named loop variable. Under the hood it desugars into a let initializer plus a while loop that increments the counter after each iteration — so the loop variable is always scoped to the loop itself.

let product be 1

repeat 5 times as j
set product to product * (j + 1)

show product

j counts up from 0 to count - 1, inclusive of 0, exclusive of count.