It is a pattern that does not use the method of Feel basic type and reference type easily with ruby.
Launch Ruby on mac terminal
irb
temp=[1,2]
temp2=temp
temp2[0]=11
temp #[11, 2]
The values (reference values) of temp and temp2 are the same
temp=[1,2]
temp2=temp
temp2=11
temp #[1, 2]
The values (reference values) of temp and temp2 are different
Recommended Posts