Why exactly is everything an expression in @rustlang ? Please show me a case where I'd use `continue`, or `break` in the context of an *expression*.
Languages do this for consistency reasons; the more consistent you can get things, the better. Forcing these things to be statements would only make them usable in less places, or more awkward to use
-
-
Most languages I've worked on so far have a healthy mix of both. Essentially, it's an expression if it makes sense to use in a context of an expression. Generally, there is always the escape hatch with compound expressions `{ ... }`.
-
How does `if return 5 {};` ever come up in real code? Or `5 + return;` (grammatically legal in rust, since return is an expression)?
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.