# Call the each method of each collection in turn.
# This is not a parallel iteration and does not require enumerators.
def sequence(*enumerables, &block)
enumerables.each do |enumerable|
enumerable.each(&block)
end
end
# Examples of how these iterator methods work
a,b,c = [1,2,3],4..6,'a'..'e'
print "#{sequence(a,b,c) {|x| print x}}\n"
为什么结果是:
123456abcde[[1, 2, 3], 4..6, "a".."e"]
谁能告诉我为什么 [[1, 2, 3], 4..6, "a".."e"] 被打印出来了?或者告诉我为什么 'sequence' 方法的返回值是 [[1, 2, 3], 4..6, "a".."e"]?? 非常感谢