Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
RobertKerans
5y ago
0 comments
Share
It is pattern matching, the semantics are an OCaml/ML family `match` expression.
0 comments
default
newest
oldest
moonchild
5y ago
Ah, so it is[0]. The GP's example doesn't require pattern matching though; as I mentioned, it would work in a language lacking it.
0.
https://haxe.org/manual/lf-pattern-matching-structure.html
yawaramin
5y ago
How so?
moonchild
5y ago
[playerA.move, playerB.move] is an array literal value, as are [Rock, Scissors] and the other controlling expressions. The switch simply performs a direct comparison between the two; there need be no destructuring for that to work.
1 more reply
j
/
k
navigate · click thread line to collapse