test is a pattern which matches only if the evaluation of test yields True.
test represents a rule which applies only if the evaluation of test yields True.
test is a definition to be used only if test yields True.
Example: The pattern x_
0 represents an expression which must be positive.
All pattern variables used in test must also appear in patt.
1 defines a function in the case when .
] allows local variables to be shared between test and rhs. You can use the same construction with Block and With.
See the Mathematica book: Section 2.3.5, Section 2.5.8.
See also: If, Switch, Which, PatternTest.
This gives a definition for a function fac that applies only when its argument n is positive.
Here is a polynomial that is defined differently for positive and negative argument.
Evaluate the cell to see the graphic.
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.