Re:Weird Expressions in Rust
by tialaramex on Saturday June 28, 2025 @08:12AM
(#44404115)
You can do this:
But yes, your larger point is exactly correct, the constant, even if it happens to be defined inside a function body, is not itself inside a function body and so we obviously can't return from it. It is also not inside an expression we can break out of (Rust allows you to break out of any expression, not just loops). It's a constant, like 5 is a constant, or 'Z' is a constant - this is not C or C++ where "const" means "actually a variable".
[ Parent
| on HN ]
There are no comments on this comment yet.