Hi I feel like i am missing something here
In the B4x Basic language booklet it states
... strings are categorized as non-primitive types.
When you pass a non-primitive to a sub or when you assign it to a different variable, a copy of the reference is passed.
This means that the data itself isn't duplicated.
I made a really simple example to try this out.
if no copy of "a" is made, just a copy of its reference, then vars sP and s are referencing the same data. So how is the value of s in the msgbox call is still "a".
Thanks for any guidance.
In the B4x Basic language booklet it states
... strings are categorized as non-primitive types.
When you pass a non-primitive to a sub or when you assign it to a different variable, a copy of the reference is passed.
This means that the data itself isn't duplicated.
B4X:
Sub sub1(sP As String)
sP = "b"
End Sub
Dim s As String
s = "a"
sub1(s)
Msgbox(s) 'displays "a"
I made a really simple example to try this out.
if no copy of "a" is made, just a copy of its reference, then vars sP and s are referencing the same data. So how is the value of s in the msgbox call is still "a".
Thanks for any guidance.