Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Syntax error with array interpolation

Reply
Thread Tools

Syntax error with array interpolation

 
 
Ronald Fischer
Guest
Posts: n/a
 
      06-25-2007
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 <>
Phone: +49-89-452133-162
=20

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory error with quadratic interpolation Isaac Won Python 15 01-24-2013 10:30 AM
Syntax error? What syntax error? Assignment fo default values? Mark Richards Perl Misc 3 11-18-2007 05:01 PM
Syntax bug, in 1.8.5? return not (some expr) <-- syntax error vsreturn (not (some expr)) <-- fine Good Night Moon Ruby 9 07-25-2007 04:51 PM
Syntax error with array interpolation Ronald Fischer Ruby 2 06-25-2007 03:04 PM
Complier error!! error C2059: syntax error : '(' Balaji C++ 3 12-03-2004 11:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57