Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

`return` doesn't have braces either.



Closest thing to a real interblock branch without braces, IMO, is `break` and `continue`, but those are both at least lone statements, not expressions. It "looks like" control flow. Personally, I don't count `return`, I view it as it's own thing from a logical standpoint. Obviously if we were talking about literal CPU doing a jump, well then a lot of things would count, but that's not what I mean in the frame of structured control flow and more in the realm of implementation details.


I could have sworn that like most modern languages Go has `break label` although being statement oriented it doesn't have `break label value`.


It does. Hell, Go also has a goto statement as well, although obviously that's unstructured control flow.

A more refined version of what I originally said would say "conditional branch" instead of "branch", but I'll admit that my original message should have been worded more carefully. I think people understood it, but taken literally it's not a strong argument.


I love Rust's ability to return a value from a loop, it's so nice.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: