Syntax error with array interpolation

R

Ronald Fischer

Below is a code snippet which gives me some headache:

def headache
yield(*(foo(1)),"bar")
end

def foo(n)
[n,n+2,n+5]
end

headache { |a,b,c,d| puts a.to_s; puts b.to_s; puts c.to_s; puts d }

I had expected that this would print


--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
=20
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top