Hacker News new | ask | show | jobs
by iamforreal 2948 days ago
Honestly, I would just not use it wherever possible. It's a wart on the language, and there are plenty of semantically superior alternatives. I would rather wrap in function + use return over break, use a sentinel value, or raise an exception over using the else block.

If there's anything I've learned, it's that just because a language has a feature, doesn't mean it should be used.

1 comments

Function + return seems like a good solution, but I'd rather not keep additional state or use `raise` (ie socially acceptable GOTO) when the language has a primitive for this.

You shouldn't use a feature just because a language has it, you should use it because it's a simple, well-defined primitive that's less complex than alternatives.