3 ms·
I do because return means end of scope. Except in your example it hides the fact that it's creating it's own scope. I'm not arguing other languages can't produ
by moonchrome 4y ago
I do because return means end of scope. Except in your example it hides the fact that it's creating it's own scope.
I'm not arguing other languages can't produce bad code, just that ruby is particularly suited for it especially as number of developers working on code increases. I've seen people propose a linter to enforce consistency - but at that point I might as well chose a language with better design choices - plenty of alternatives these days.
- codesnik 4y agoIt doesn't create no scope. Even for variables.
- multiplegeorges 4y ago> I've seen people propose a linter to enforce consistency - but at that point I might as well chose a language with better design choices - plenty of alternatives these days. You're seriously proposing that adding a linter has the same organizational costs as changing languages entirely. Meanwhile, back in the real world... Ruby has major advantages over many other languages and a linter is basic tooling you should have in every development environment.
- ezekg 4y agoRuby doesn't create a new scope for if/unless.