Scala @ operator

后端 未结 5 1658
别那么骄傲
别那么骄傲 2020-11-27 09:32

What does Scala\'s @ operator do?

For example, in the blog post Formal Language Processing in Scala, Part 2 there is a something like this

c         


        
5条回答
  •  抹茶落季
    2020-11-27 10:34

    When pattern matching variable @ pattern binds variable to the value matched by pattern if the pattern matches. In this case that means that the value of x will be Some(Nil) in that case-clause.

提交回复
热议问题