Re:Rust for JavaScript Developers – Functions and Control Flow
by jurip on Monday July 06, 2020 @03:46AM
(#23745614)
Agreed about missing if and switch expressions in Swift. My preferred way of writing that would be:
That way you get immutable foo and the compiler will shout at you if you forget to assign the value in one branch. It's not quite as nice as an expression, but it's less punctuation than the closure and the result is just as safe.
[ Parent
| on HN ]
There are no comments on this comment yet.