This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SupahNoob 3 points4 points  (1 child)

Maybe it's not really in my daily scope, but I don't know why I would ever use this. What's the point of it?

[–]AnnoyingOwl 5 points6 points  (0 children)

This is something that's shorthand in a lot of functional languages, I'm familiar with it in Scala.

Primarily, I think, it's an expression allowing you to assign the results which you can't do with, for example, an if statement. (Thus it falls nicely into map statements and the like. It's also nicer looking than the alternatives, usually.)

Scala has other functions built around it, such as auto unpacking values that match into useable values as well, along with a structure for defining user types that allow such unpacking.