Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
pmontra
on Dec 13, 2022
|
parent
|
context
|
favorite
| on:
Read this post ‘unless’ you’re not a Ruby develope...
Those one line returns are particularly handy at the beginning of methods, to validate or process arguments and return immediately for simple cases.
hnzix
on Dec 13, 2022
|
next
[–]
Short circuiting is such a beautiful way of avoiding giant nested "if" mountains. I wish it was more widely used.
ilyt
on Dec 13, 2022
|
prev
[–]
right but
if condition { return }
works well enough in other languages and shows actual condition (the important part) to programmer first. if that
if
and extra brackets is really too long Perl way is also option.
condition || return
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: