Iterate in loopsΒΆ

FriCAS provides an iterate expression that skips over the remainder of a loop body and starts the next loop execution. We first initialize a counter.

i := 0
 0
                    Type: NonNegativeInteger

Display the even integers from 2 to 5:

repeat
  i := i + 1
  if i > 5 then leave
  if odd?(i) then iterate
  output(i)
 2
 4
                    Type: Void

Table Of Contents

This Page