Array confusion

[code]dim s() As String
s= array(“bob”,“sue”,“fred”)
Break
dim tmp() As String

tmp=s

tmp.Remove(tmp.IndexOf(“bob”))
Break
[/code]

I am trying to remove the element from just tmp but both tmp and s end up with same value with the element removed

I would think s would be unaffected.

TIA

https://blog.xojo.com/2018/12/12/what-kind-of-variable-are-you/

Yep just saw
in the byval docs

All arrays and objects are passed by reference, not copied, so changes to that array or object will be reflected in the calling method. This is no different than assigning an array or object to a second variable or property.

dim s() As String s= array("bob","sue","fred") Break dim tmp() As String for i as Integer =0 to s.Ubound tmp.Append(s(i)) next tmp.Remove(tmp.IndexOf("bob")) Break

Seems to do the trick