Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created January 7, 2012 22:50
Show Gist options
  • Select an option

  • Save diegopacheco/1576357 to your computer and use it in GitHub Desktop.

Select an option

Save diegopacheco/1576357 to your computer and use it in GitHub Desktop.
Scala Pattern Matcher with var
object MatcherThisVar extends App {
class Sample{
val max = 100
val MIN = 0
def process(input:Int){
input match{
case this.max => println("This max 100")
case MIN => println("MIN 0")
case _ => println("???")
}
}
}
new Sample().process(100)
new Sample().process(0)
new Sample().process(2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment