::
Factor handbook » The language » Lexical variables

Prev:Examples of lexical variables
Next:M::


Vocabulary
syntax

Syntax
:: word ( vars... -- outputs... ) body... ;


Word description
Defines a word with named inputs. The word binds its input values to lexical variables from left to right, then executes the body with those bindings in scope.

If any var name is followed by an exclamation point (!), the corresponding new variable is made mutable. See Mutable lexical variables for more information.

Notes
The names of the outputs do not affect the word's behavior. However, the compiler verifies that the stack effect accurately represents the number of outputs as with : definitions.

Examples
See Examples of lexical variables.

Definition