Ruby/Array/clone

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

Using the clone method is the actual way of copying between arrays.

a = [1,2,3,4,5]
b = a.clone
puts b
a = [1,2,3,4,5]
b = a.collect{|x| 10*x}
puts b