Let’s say I have this array:
a = [0,1,2,3,4,5]
How would I get entries 2 and 4 (say) from the array? I’d love something like
x, y = a.entries_at(2, 4)
but I want something built-in. Is there anything in the Ruby stdlib that does this? It’s hard to google for.
You’re spot on with your guess. It’s called
values_at: