REBOL Document

Has - Function Summary


Summary:

A shortcut to define a function that has local variables but no arguments.

Usage:

has locals body

Arguments:

locals - The locals argument. (must be: block)

body - The body argument. (must be: block)

Description:

Defines a function that consists of local variables only. This is a shortcut for FUNC and FUNCTION.

For example:


    ask-name: has [name] [
        name: ask "What is your name?"
        print ["Hello" name]
    ]


    ask-name
    What is your name?Hello test

The example above is a shortcut for:


    ask-name: func [/local name] [...]

Related:

does - A shortcut to define a function that has no arguments or locals.
exit - Exits a function, returning no value.
func - Defines a user function with given spec and body.
function - Defines a user function with local words.
return - Returns a value from a function.
use - Defines words local to a block.


<Back | Index | Next>

Copyright 2004 REBOL Technologies