NLI: Function: block

Background: NLI, Expressions, Functions
Related: Examples

Description:
The block function groups a number of expressions as one. It is frequently used in the if function's then or else case to execute a group of expressions. It also creates a new scope for variables.
A block returns the result of the last expression wihin block.

General Format:
(block [expr1] [expr2] ...)

Examples:
(; If john is a doctor, then set him to like golf and hate cartoons)
(if (get doctor instance john)
    (block
        (set john like golf)
        (set john hate cartoons)
    )
)

Notes:

CM ©2000-2007