The pattern matching in Mathematica gives you a powerful way to define recursive functions.
For example if you'd like to write a function which takes a Mathematica function definition and generates C-Code from it:
<< SymbolicC`
ClearAll[toSymbolicC]
SetAttributes[toSymbolicC, {HoldAll}]
toSymbolicC[x_List] := toSymbolicC /@ x
toSymbolicC[(op : (Plus | Times))[args___]] :=
COperator[op, toSymbolicC[{args}]]
toSymbolicC[(op : (Cos | Sin))[x_]] :=
CStandardMathOperator[op, toSymbolicC[x]]
toSymbolicC[x_] := x
I know this should be more elaborated but for the sake brevity I just defined functions for lists, two commutative operators, Cos and his imaginary friend ;).
You'd use it in that way:
toSymbolicC[Cos[x] + Sin[x]]
which yields:
COperator[Plus, {CStandardMathOperator[Cos, x], CStandardMathOperator[Sin, x]}]
to convert this into a regular C-Expression you'd use (of course you could've done this in postfix form)
ToCCodeString[%]
Hope this gave an idea about the power of pattern matching, especially in symbolic programming languages like Mathematica.
Patterns in Mathematica