MiP
MiP

Reputation: 6432

How to use `&` in match expression?

In Symbol and Operator Reference, the symbol & is used for:

Links: Match Expressions

  • Computes the address of a mutable value, for use when interoperating with other languages.

  • Used in AND patterns.

I've looked at the Match Expressions page but I didn't see any AND patterns. How can I use the & patterns?

Upvotes: 6

Views: 125

Answers (1)

John Palmer
John Palmer

Reputation: 25516

The and pattern syntax looks like the following:

(a, b) & (_, "test")

It is documented here.

Upvotes: 5

Related Questions