Loops/Foreach

fn main() {
    let colors: string[4] = ["red", "blue", "green", "yellow"];
    for color in colors { println "{color}"; }
}

Output:

red
blue
green
yellow

Attribution: This is a community solution for the Rosetta Code task Loops/Foreach in Zen C.

This article uses material from the Rosetta Code article Loops/Foreach, which is released under the GNU Free Documentation License 1.3. A list of the original authors can be found in the page history.