Optional (:)

Optional[patt, default] or patt : default
is a pattern which matches patt and which, if omitted should be replaced by default.

• f[x_, y_:1] := {x, y}

• f[1, 2]

• f[a]

Note that symb : patt represents a Pattern object. However, there is no disambiguity, since symb has to be a symbol in this case.

• x:_ // FullForm

• _:d // FullForm

• x:_+y_:d // FullForm

s_. is equivalent to Optional[s_] and represents an optional parameter which, if omitted, gets its value from Default.

• FullForm[s_.]

• Default[h, k_] := k

• h[a] /. h[x_, y_.] -> {x, y}