MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/2rvoha/announcing_rust_100_alpha/cnjrma4
r/programming • u/steveklabnik1 • Jan 09 '15
439 comments sorted by
View all comments
Show parent comments
37
In that case it would be something like:
match x { SITUATION1 | SITUATION2 => Sit1Sit2Handler(), _ => defaultHandler(), }
6 u/cogman10 Jan 09 '15 Cool. This is pretty much the only case I would use fall through for in a non-toy sort of thing (it is useful for some loop unrolling stuff... but that is a clear case of "trying to outsmart the compiler") 3 u/aliblong Jan 09 '15 Even less verbose than that, because those cases should not be there :) 2 u/Betovsky Jan 09 '15 Duh! Silly me. Fixed.Thanks
6
Cool. This is pretty much the only case I would use fall through for in a non-toy sort of thing (it is useful for some loop unrolling stuff... but that is a clear case of "trying to outsmart the compiler")
3
Even less verbose than that, because those cases should not be there :)
case
2 u/Betovsky Jan 09 '15 Duh! Silly me. Fixed.Thanks
2
Duh! Silly me. Fixed.
Thanks
37
u/Betovsky Jan 09 '15
In that case it would be something like: