[Gambas-user] Variable ByVal
sakya
sakya_tg at ...325...
Fri Nov 25 16:16:27 CET 2005
Ciao Leonardo!
> It is very strange for me, because all the operations are made on
> matrix[], which gets its datas from matrice2[], not directly from
> matrice[].
>
It's normal. :-)
The line:
matrice2 = matrice
Doesn't copy the matrix in a new variable, it only "links" matrice to
matrice2.
Every changes made on matrice are made also on matrice2 (they are tha
same variable!)
In this example you'll see "d" also in a:
DIM a AS NEW String[]
DIM b AS NEW String[]
a.Add("a")
a.Add("b")
a.Add("c")
b = a
b.Add("d")
message(a.Join())
To copy a matrix you must do:
matrice2 = matrice.copy()
In this example you won't find "d" in a:
DIM a AS NEW String[]
DIM b AS NEW String[]
a.Add("a")
a.Add("b")
a.Add("c")
b = a.Copy()
b.Add("d")
message(a.Join())
Ciao
Paolo
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
More information about the User
mailing list