Language - Loop (For, While) - (Break, Continue)

Table of Contents

1 - About

Repeating a set of actions until a certain condition fails is the job of programming loops;

loops can take different forms, but they all satisfy this basic behavior.

A loop includes:

  • the test condition
  • as well as a block (for instance { .. }.

Each time the loop block executes, that’s called an iteration. See Design Pattern - (Iterator|Cursor)

The only practical difference between these loops is whether the conditional is tested before the first iteration (while) or after the first iteration (do.. while).

  • The break statement stop a loop.
  • The continue statement goes to the next iteration without running the code below it.
code/grammar/loop.txt · Last modified: 2017/09/20 22:34 by gerardnico