r/ruby • • Jul 09 '23

So much knowledge in one joke

Post image
130 Upvotes

18 comments sorted by

View all comments

Show parent comment

4

u/tinco Jul 09 '23

*?1..?3

I'm not sure, it doesn't work. I didn't know you could use question mark to get character literals so that's a TIL, but splatting a range like that doesn't work.

You could do this though: (?1..?3).to_a

Did reddit mangle the code? Maybe there's some other syntax feature I'm missing..

3

u/143Crimson Jul 09 '23 edited Jul 10 '23

It should instead have been [*?1..?3]