WLJS LogoWLJS Notebook

BlankSequence

__ (two underscores) or BlankSequence[] is a pattern that can stand for any sequence of one or more expressions.

__h can stand for a sequence of one or more expressions with head h.

Examples

Match one or more arguments:

f[x__] := {x}
f[a, b, c]
(* {a, b, c} *)

In replacement:

{1, 2, 3, 4} /. {__, x_} :> x
(* 4 *)

Please visit the official Wolfram Language Reference for more details.

On this page