I've seen both _ => ()
and _ => {}
used at the end of match
statements. Which is preferred (if either) and why?
Thanks!
-jgilray
I've seen both _ => ()
and _ => {}
used at the end of match
statements. Which is preferred (if either) and why?
Thanks!
-jgilray
I would say that the former is "produce a unit" and the latter is "do nothing", which do the same thing but express different intent.
I would normally use _ => {}
.
Recently I'm using drop
for it.
I agree, this one allows to later on change your mind and add something like a print statement within the curly braces
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.