REBOL Document

Break - Function Summary


Summary:

Breaks out of a loop, while, until, repeat, foreach, etc.

Usage:

break

Refinements:

/return - Forces the loop function to return a value.

value - The value argument. (must be: any-type)

Description:

The current loop is immediately terminated and evaluation resumes after the LOOP function. This function can be placed anywhere within the block being repeated, even within a sub block or function.


    repeat n 5 [
        print n
        if n > 3 [break]
    ]
    1
    2
    3
    4

Related:

catch - Catches a throw from a block and returns its value.
exit - Exits a function, returning no value.
for - Repeats a block over a range of values.
forall - Evaluates a block for every value in a series.
foreach - Evaluates a block for each value(s) in a series.
forever - Evaluates a block endlessly.
forskip - Evaluates a block for periodic values in a series.
loop - Evaluates a block a specified number of times.
repeat - Evaluates a block a number of times or over a series.
return - Returns a value from a function.
until - Evaluates a block until it is TRUE.
while - While a condition block is TRUE, evaluates another block.


<Back | Index | Next>

Copyright 2004 REBOL Technologies