Yeah it is quite simple, what you also can do is use this in a switch statement:
switch(person){ case(Elf f): break; }
person switch { case Elf elf =>.... case Dwarf dwarf =>...
}
You can even omit the case keyword.
Very cool. Wish I'd known about that a few weeks ago. So many features to keep track of across so many languages!
Yes indeed, In this blog series I’ll mainly focus on such lesser known features, stay tuned!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah it is quite simple, what you also can do is use this in a switch statement:
person switch {
case Elf elf =>....
case Dwarf dwarf =>...
}
You can even omit the case keyword.
Very cool. Wish I'd known about that a few weeks ago. So many features to keep track of across so many languages!
Yes indeed, In this blog series I’ll mainly focus on such lesser known features, stay tuned!