Pattern matching in D?
Dennis Ritchie via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 20 20:46:26 PDT 2016
On Friday, 21 October 2016 at 02:40:45 UTC, Stefan Koch wrote:
> How is this diffrent from "switch-case" ?
A more laconic and convenient form of the recording conditions:
* No need to constantly write "case", "break", "case", "break",
...
* You can use the "|", it facilitates the matching also inside
the body "match" and allows the use of multiple patterns
* Works with tuples and slices
* More modern than the "switch"
* etc.
https://doc.rust-lang.org/stable/book/slice-patterns.html
https://doc.rust-lang.org/stable/book/box-syntax-and-patterns.html
More information about the Digitalmars-d
mailing list