Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
stormdennis
on Dec 13, 2022
|
parent
|
context
|
favorite
| on:
Read this post ‘unless’ you’re not a Ruby develope...
Unless would drive me insane. I do use IF NOT but when reading code my brain understands this format most clearly:
IF some-expression
ELSE Do-something
shortcake27
on Dec 13, 2022
[–]
`unless` is generally used for guard clauses (eg `return unless authorized?`) or when there’s only one branch. You don’t tend to see `unless` used with multiple branches.
Alifatisk
on Dec 13, 2022
|
parent
[–]
This, I’ve mostly used unless with guard clauses
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
IF some-expression
ELSE Do-something