Friday, 13 September 2013

Returning a value of ruby is strange

Returning a value of ruby is strange

could anyone tell me the return value of this function give the parameter
listed blew:
def sequence(*enumerables)
enumerables.each do |enumerable|
print "#{enumerable},"
end
end
a,b,c = [1,2,3],4..6,'a'..'e'
value = sequence(a,b,c)
print value
why the value is evaluated to be:
[[1,2,3],4..6,"a".."e"]

No comments:

Post a Comment