Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 657
MiP Avatar asked Apr 08 '17 11:04

MiP


People also ask

How do we use a semicolon?

Use a semicolon to replace a period between related sentences when the second sentence starts with either a conjunctive adverb or a transitional expression, such as for example, for instance, that is, besides, accordingly, furthermore, otherwise, however, thus, therefore.

When should a semicolon be used examples?

A semicolon may be used between independent clauses joined by a connector, such as and, but, or, nor, etc., when one or more commas appear in the first clause. Example: When I finish here, and I will soon, I'll be glad to help you; and that is a promise I will keep.

How do you use commas and semicolons?

When a comma separates two complete sentences joined by a conjunction (and, but, or, nor, for, so, or yet) the comma and the conjunction can be replaced with a semicolon. I ate dinner, and I went to the movies. = I ate dinner; I went to the movies. She finished top of her class, but she was struggling to find work.

How do you use a colon example?

Connecting two related sentences A colon can be used to connect two independent sentences. Typically, a colon is used when the second sentence clarifies or explains the first sentence. For example, Me and my sisters are really excited: We're going to Disneyland!


1 Answers

The and pattern syntax looks like the following:

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

It is documented here.

like image 157
John Palmer Avatar answered Oct 23 '22 04:10

John Palmer