Command: procedure

Syntax

procedure <name> {
    <command_block>
}

Description

Create or redefine a procedure (a user function).

Parameters

Switches

None

Notes

This command is synonymous with numeric_function command although its return value is generally not used.

Care should be taken to avoid infinite recursive loops where a procedure calls itself directly or indirectly.

When a procedure resides in an atable, the value of scope during execution of the procedure is set to that atable.

Caret substitution will be performed at procedure execution time. For caret substitution to be performed at definition time, begin a command in command_block with a / to expand ^(...) phrases on that particular line.

Example

Create a proceudure to print a few statistics.

procedure pstats {
    idir ~*.*, -pr
    glist -pr
    list -fk, -ev, -pr
}
 
# Use of the function ...
pstats()

See Also

Commands:

args, exec, numeric

Identifiers:

funcval (generic), scope (atable)