FOR Loop construct that repeats the loop within until every value has been processed.
CONTROLS
FOR variable reach block
variable - description of the value
/refinement - description of refinement This method has no refinements Not applicable on category
FOR long description
Descriptions and
number: 29
binary-string: ""
for index 32 [
either is-odd number [
binary-string: join/with "1" binary-string
][
binary-string: join/with "0" binary-string
]
number: number >> 1 ; this or
]
write/line binary-string
You can also automatically count down or in a given range:
index: to whole! 0
FOR index [9 -9] [write/line index]
We do have to take care of the SIZE! of index or else Meta chooses BYTE! type and never reaches the negative numbers, looping around within the values of a BYTE!
FOR-EACH
FOREVER
REPEAT
WHILE
UNTIL