Meta Project

The Unofficial Meta Documentation

REPEAT

Summary

REPEAT Loop construct that repeats the loop a given number of times.

Category

CONTROLS

Usage

REPEAT value block

Arguments

value - numeric value

block - Block with the instructions to process within the loop

Refinements

This method has no refinements

Description

REPEAT Loop construct that repeats the loop a given number of times.

Example Code

Use REPEAT to write 100 random numbers

random/seed now
repeat 100 [
    random-byte: random 255
    while random-byte > 199 [
        random-byte: random 255
    ]
    random-100: 1 + modulo random-byte 100
    write/line random-100
]

Related

FOR-EACH  
FOREVER  
FOR  
WHILE  
UNTIL  

Back to the Meta Methods Reference index