|
|
|
|
|
by stefano_c
1277 days ago
|
|
I've been writing Ruby for 20+ years and "unless" (the whole language, actually) immediately clicked for me when I first learned it. That said, I only use it in 2 cases: * as a trailing condition (do_something unless this), mainly for early returns
* as the only arm of a multi-line block (unless this ... end, no "else" blocks - Rubocop would yell at me anyway) And then only if the condition is either a simple value, or a combination of simple values (this && that, this || that). That's it. Never had a problem with double negatives or accidentally inverting the logic. |
|
Of course one can avoid it at all but of course one cannot avoid to spend time on it when reading somebody's else code.