lesson 08 / 15
For loops
A for loop binds one item at a time to a variable. The loop body can access global variables and use normal interpolation.
packages:
- "kpkg"
- "kosh"
- "jumpstart"
main {
for package in packages {
print "building $package"
}
}Inline list literals can be useful for short, local lists.
main {
for shell in ["kosh", "bash", "zsh"] {
print "checking $shell"
}
}