REBOL Document

Use - Function Summary


Summary:

Defines words local to a block.

Usage:

use words body

Arguments:

words - Local word(s) to the block (must be: block word)

body - Block to evaluate (must be: block)

Description:

The first block contains a list of words which will be local to the second block. The second block will be evaluated and its results returned from the USE.


    total: 1234
    nums: [123 321 456]
    use [total] [
        total: 0
        foreach n nums [total: total + n]
        print total
    ]
    900


    print total
    1234

Related:

User Comments:

-From: lmecir_mbox.vol.cz 2-Dec-2000/9:06:25-8:00:

Warning: Use modifies its Body argument. If you need to reuse it (in the case you are writing a recursive function, e.g.), use it in combination with copy/deep as in:


    use words copy/deep body


<Back | Index | Next>

Copyright 2004 REBOL Technologies