You could also use pattern matching if you prefer ...
# arrow
s
You could also use pattern matching if you prefer then it would look more like your scala snippet