fun describe(pet: Pet): String =
match pet {
Cat(name, lives) => "cat $name has $lives lives"
Dog(name, years) => "dog $name is $years old"
}
... can be replaced with ...
fun describe(pet: Pet): String =
if pet
... is Cat(let name, let lives) { "cat $name has $lives lives" }
... is Dog(let name, let years) { "dog $name is $years old" }
This means that ...
... can be replaced with ...
and
match
removed from the language completely.