Atuple patternhas the form(p1, p2, … pn)
wherep1
throughpn
are patterns. The pattern matches if the scrutinee is a tuple of the samearityas the pattern andp1
throughpn
match against the elements of the tuple. The pattern(p)
is the same as the patternp
,and the pattern()
matches the literal value()
of the trivial type {()} (both pronounced “unit”).
For example, this expression evaluates to `4`: