Loops/Infinite

Zen C provides a dedicated loop keyword for creating infinite loops. This is the idiomatic alternative to while (true). Zen C also supports loop labels (like, outer: loop) to easily break out of deeply nested infinite loops.

fn main() {
    // A simple infinite loop
    loop {
        println "SPAM";
    }
}

Output:

SPAM
SPAM
SPAM
SPAM
SPAM
...

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

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