Ruby 1.9 Fun

Dave Thomas (of Pragmatic Programmers fame) describes some new Ruby 1.9 syntax:

first, *, last = 1,2,3,4,5
puts first
puts last

will produce


The same syntax also works for method definitions

def test( first, *, last)
  puts first
  puts last
test( 1, 2, 3, 4, 5 )

will produce the same output as above.

Farrel Lifson is a lead developer at Aimred.

About Aimred

Aimred is a specialist Ruby and Ruby on Rails development house and consultancy based in Cape Town, South Africa.

We provide Ruby and Ruby on Rails development, consulting and training services to businesses and organisations of all sizes. If you want to find out how we can help you, contact us at

Recent Posts

Yearly Archives