Alternatives

p1|p2|

is a pattern object that represents any of the patterns pi.

Details

  • If a named pattern such as x_ appears in pi that are not used in a particular match, then the named pattern is taken to have a value that is a zero-length sequence Sequence[].

Examples

open allclose all

Basic Examples  (2)

Replace instances of either a or b:

Specify a function for several argument types:

Scope  (2)

Pick out integers or reals:

Replace in an association using alternative patterns:

Introduced in 1991
 (2.0)