Legacy Documentation

Mathematica® Teacher's Edition (2002)

This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  Built-in Functions /  Programming /  Pattern Matching /

Condition

FilledSmallSquare patt /; test is a pattern which matches only if the evaluation of test yields True.
FilledSmallSquare lhs :> rhs /; test represents a rule which applies only if the evaluation of test yields True.
FilledSmallSquare lhs := rhs /; test is a definition to be used only if test yields True.

FilledSmallSquare Example: The pattern x_ /; x > 0 represents an expression which must be positive.
FilledSmallSquare All pattern variables used in test must also appear in patt.
FilledSmallSquare Example: f[x_] := fp[x] /; x > 1 defines a function in the case when .
FilledSmallSquare lhs := Module[vars, rhs /; test] allows local variables to be shared between test and rhs.
FilledSmallSquare See The Mathematica Book on the web: Section 2.3.5 and Section 2.5.8.
FilledSmallSquare See also: If, Switch, Which, PatternTest, Element.