Mega Code Archive

 
Categories / Ruby / Array
 

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