As you hopefully know, the modern C# equivalent is not bad either, especially with top level statements and implicit global usings (The following is the whole program):
Enums are a bit leaky, though, because C# enums can just have any old `int` chucked into them, so you really do need the final arm of the `match`. `(EnumA)100` will compile just fine!
Comments
good thing c# supports pattern match too. just this morning, I wrote something like this
suffice to say, c# is pretty ok, coming from ml family.Rust's match is pretty cool as well. Here's Fizzbuzz, lifted from [0]
I'm moving from C# to Rust at the moment and really enjoying it, especially now that I (almost) understand the borrow checker[0] https://stackoverflow.com/questions/43896431/c-sharp-equival...
As you hopefully know, the modern C# equivalent is not bad either, especially with top level statements and implicit global usings (The following is the whole program):
This is so much nicer than what was possible back when the linked question was asked.It gets a bit nicer still.
Can you match to (i % 3, i % 5) instead?
You can, yes: https://play.rust-lang.org/?version=stable&mode=debug&editio...
Enums are a bit leaky, though, because C# enums can just have any old `int` chucked into them, so you really do need the final arm of the `match`. `(EnumA)100` will compile just fine!