Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
psychoslave
on May 22, 2024
|
parent
|
context
|
favorite
| on:
Clever code is probably the worst code you could w...
With ruby 3.4 (prior to that `_1` should be used instead of `it`):
(0..10).select{it.even?}
psychoslave
on May 22, 2024
[–]
Also not that the result is `[0, 2, 4, 6, 8, 10]`, unlike the behavior of Python which exclude the value explicitely passed in parameter from the represented range.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: