From: Charles Oliver Nutter Date: 2010-05-08T13:50:06+09:00 Subject: Re: * splat error FYI: ~/projects/jruby ➔ jruby -e "def s(a,*b,c) end" :1: -e:1: syntax error, unexpected tIDENTIFIER (SyntaxError) def s(a,*b,c) end ^ ~/projects/jruby ➔ jruby --1.9 -e "def s(a,*b,c) end" ~/projects/jruby ➔ Gotta love an interpreter that's two for the price of one :) On Tue, May 4, 2010 at 4:16 AM, Robert Klemme wrote: > 2010/5/4 Kerwin Franks : >> Hello, i need some help here, when i run the following code i get the >> error below. Why is that, according to the textbook it should work, also >> looked it up in the cookbook, no luck there too. Thanks in advance. >> >> def split_apart(first, *splat, last) >>  puts "first: #{first.inspect}, splat: #{splat.inspect}, " + >>       "last: #{last.inspect}" >>  end >> >> split_apart(1,2) >> split_apart(1, 2, 3) >> >> Error: >> >> /home/gribota1/NetBeansProjects/Analyzer/lib/rubymethods.rb:32: syntax >> error, unexpected tIDENTIFIER, expecting tAMPER or '&' >> def split_apart(first, *splat, last) >>                                   ^ > > 10:49:13 test_2$ allruby -ce 'def s(a,*b,c) end' > CYGWIN_NT-5.1 padrklemme1 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin > ======================================== > ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin] > -e:1: syntax error, unexpected tIDENTIFIER, expecting tAMPER or '&' > def s(a,*b,c) end >            ^ > ======================================== > ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-cygwin] > Syntax OK > ======================================== > jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java > HotSpot(TM) Client VM 1.6.0_20) [x86-java] > SyntaxError in -e:1: , unexpected tIDENTIFIER > > def s(a,*b,c) end >            ^ > 11:16:32 test_2$ > > Cheers > > robert > > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > >