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

REBOL 3 Functions: for

for  word  start  end  bump  body

Evaluate a block over a range of values. (See also: REPEAT)


word [word!] - Variable to hold current value

start [series! number!] - Starting value

end [series! number!] - Ending value

bump [number!] - Amount to skip each time

body [block!] - Block to evaluate

See also:

loop   repeat   forall   foreach   forever   forskip   map-each   remove-each  


The first argument is used as a local variable to keep track of the current value. It is initially set to the START value and after each evaluation of the block the BUMP value is added to it until the END value is reached (inclusive).

for num 0 30 10 [ print num ]
for num 4 -37 -15 [ print num ]

  TOC < Back Next > - WIP Wiki Feedback Admin