F.E.L.T.

Functionally Equivalent Language Translation

CONTINUE

(continue)
(continue 2)    ; escape level, coder specific!

The CONTINUE instruction is used to terminate the 'current' iteration of a loop and then immediately start the next one. Exactly how is an implementation detail of the chosen back-end coder. It is similar to the BREAK instruction but does not terminate the iteration but instead forces the next iteration to begin.


The concept of 'continuing' out of a loop is a very common one in many languages and so FELT supports that notion too. It also has BREAK in its repertoire which terminates the iteration instead of making it jump to the next one in sequence.

Unless you are writing deeply nested loops (never good but sometimes you just have to!) then there is an optional second paramter to supply to the CONTINUE instruction that lets you specify the 'escape level'. The example shown on the PHP/continue page is as good as any so let's show the FELT equivalent example first:

(while (= (list key value) (each arr))
   (if (not (% key 2))
       (continue) ;; skip odd members
       ;; do something here
       (do-something-odd value)))

When rendered as PHP code we get the following code:

while(list($key, $value) = each($arr)) {
  if ((!(($key % 2)))) {
    continue;
  }
  else {
    do_something_odd($value);
  }
}

And here is the code from the PHP site for comparison.

while(list($key, $value) = each($arr)) {
    if (!($key % 2)) { // skip odd members
        continue;
    }
    do_something_odd($value);
}