logoalt Hacker News

atq2119yesterday at 8:27 AM1 replyview on HN

Those languages don't treat blocks as expressions, so you really can't do the same thing there. Something very similar, yes. But not the same.


Replies

kibwenyesterday at 1:35 PM

Those languages aren't expression-oriented, so you would need to assign the result to a previously-initialized variable in a higher scope. But that just makes this pattern clunkier in those languages. This subthread is about jumping to labels, which is a relatively obscure yet widespread feature supported by many languages (though C and Go allow forward jumps, and the rest only allow backward jumps, since the latter ensures that control flow does not become irreducible).