I want to know how I can pass values NOT by reference, but by value. When I write:
var array1 = [1,2,3,4,77,788]
var array2 = array1
print(array1) #print': 1,2,3,4,77,788,1
They are passed by reference.
because array1 and array2 two "point" to the same data.
How can I duplicate them. I'm searching for something like:
array2 = array1.cloned()
For arrays specific I already know some work arounds but how do I do it with custom objects?