|
|||||
Pattern variables and local scopes | |||||
Prerequisite Concepts | Related Syntax |
Pattern variables are "declared" in a manner slightly different from other names: they are declared in a pattern assignment embedded in a pattern (using =>
), instead of in a variable declaration.
Because pattern variables are declared and can be referenced before the local scope begins, they are treated differently than the variables declared within the local scope. In effect, they are treated as if two local scopes are defined, one within the other. The outer one defines the pattern variables, and the inner can contain local declarations to declare other kinds of shelves.
This means:
match
pattern can also be referenced in the condition which follows it. (Versions of OmniMark prior to V3 did not permit this.)
match
pattern. The declared local variable hides the pattern variable.
The other context in which patterns, and therefore pattern assignments, can occur, is the second argument of the matches
operator. This argument defines an entire local scope itself. This means that:
Prerequisite Concepts Pattern matching Scope of variables |
Related Syntax pattern |
---- |