The Ruby Programming Language
#There is a lot of flexibility! def my_method(a,b,c) puts a + " " + b + " " + c end my_method( 'j', 'o', 'e') # j o e #default args def get_data(name="peter") "#{name}" end get_data #peter get_data("john") #john #Variable number of arguments def varargs(first, *rest) "Got #{first} and #{rest.join(', ')}" end varargs("one") #Got one and varargs("one", "two", "three")#Got one and two, three varargs "one", "two", "three" #Got one and two, three
7 of 11