REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 13-Aug-2010 Edit History  

REBOL 3 Functions: repeat

repeat  word  value  body

Evaluates a block a number of times or over a series.


word [word!] - Word to set each time

value [number! series! none!] - Maximum number or series to traverse

body [block!] - Block to evaluate each time

See also:

loop   foreach   forall   forskip   for   while   until  


The repeat function is an easy way to repeat the evaluation of a block with a loop counter.

repeat num 3 [print num]

Here the num counter begins at one and continues up to and including the integer value given.

Other Notes

In question...

If the value is a series, then the loop will repeat for each element of the series.

However, there's currently a difference between R2 and R3. In R2, if the value is a series, then the word holds the first value of each element of the series. In R3 it holds just the indexed series.

Editor note: Determine if this is intentional

  TOC < Back Next > - WIP Wiki Feedback Admin