4 ms·
In Rust, some expressions (e.g. `while`) always evaluate to `()`. What’s the benefit of that compared to making `while` a statement?
by pansa2 6y ago
In Rust, some expressions (e.g. `while`) always evaluate to `()`. What’s the benefit of that compared to making `while` a statement?
- deleted 6y ago[deleted]
- creata 6y agoI can't think of a benefit (besides consistency, which might be nice for some macros) but is it doing any harm? And, in the future, if Rust does get some kind of return-via-break for while loops (like it has for `loop`s) then there'll be less syntax to change.