Last active
October 3, 2021 19:41
-
-
Save lucaspolo/0029da658e70f98819cea95f37717b52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CasamentoDePadroes extends App { | |
case class Pessoa(nome: String, idade: Int); | |
var pessoa = Pessoa("Linus", 51); | |
pessoa match { | |
case Pessoa("Lucas", _) => println("Olá programador Lucas") | |
case Pessoa(nome, idade) if idade > 50 => println(s"Olá Sr(a) $nome") | |
case Pessoa(nome, _) => println(s"Olá $nome") | |
case _: Pessoa => println("Olá desconhecido") | |
case _ => println("Error") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment