Vincent's Blog


  • Home

  • Categories

  • Archives

  • Tags

Scala - Pattern Match - @

Posted on 2017-02-19   |   In Scala
that match{
case p @ Person(_, age) if p != bill => age
case Person(_, age) => age - 15
case _ => println("Not a person")
}
  • 如果直接Person(name,age) 是为了后面用这两个变量参数
  • 如果 case x:Person 是用这个case class的对象
  • 如果 p @ Person(name,age) 后面是可以对象和参数都用的

http://stackoverflow.com/questions/20748858/pattern-matching-symbol

#Scala
Scala - Seq
Scala - Currying
  • Table of Contents
  • Overview
Vincent Guo

Vincent Guo

the blog to remeber all things about code

290 posts
44 categories
103 tags
RSS
github twitter facebook google weibo
Links
  • KunLin
  • Rx Introduction
  • 三哥
  • 元龙

This post does not have a Table of Contents

© 2024 Vincent Guo
Powered by Hexo
Theme - NexT.Mist