The way to use append
in Golang
is described as following:
|
|
because append
may either modify its argument in-place or return a copy of its argument with an additional entry, depending on the size and capacity of its input. Using a slice that was previously appended to may give unexpected results.
Read it carefully
That basically is saying you cannot use array
when you use slice
. But why would you want to? Mother knows best, stick to slice
after all.
Run following code to have your hair streched:
|
|