Thread: Ruby Snippets
View Single Post
Old Apr 14th, 2006, 11:02 PM   #23
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
Master is right.

The correct way to do it is like this:

def func(args = {:a => 2, :b => 3}) #default values
    puts "a: #{a}\nb: #{b}"
end

func(:a => 3, :b => 4)
#=> a: 3
#     b: 4
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote