Skip to main content

Control Flow

This chapter covers how to direct program execution with conditional statements, loops, and exception handling. These constructs form the backbone of any Zymba program.

Zymba control flow closely mirrors JavaScript and PHP: if/else, for, while, switch, and try/catch all work as expected. Zymba adds a few ergonomic extras — the unless keyword (inverse if), the for-as array iteration loop, and an explicit loop keyword for infinite loops.

See also

  • Conditionalsif, unless, switch, ternary
  • Loops — C-style for, for-as, while, do-while, loop
  • Exceptionstry/catch/finally, throw, patterns