Basic4android follows Java parameter passing. Objects are passed by reference and "primitives" are passed by value.
Arrays are objects so are always passed by reference.
Maybe I something in the documentation, Ive noticed in my applications that that when I call a Sub routine the "variables" that are passed are a reference to the variable. WHich is the default for VB6 as well. My question is, how to I pass a copy of the variable? The ByVal would achive this...
www.b4x.com
Since 'avar' is a string, it's being passed as a value. If you want to change the value of that specific variable, you'll have to reference it through it's module.
OR
return the value and change it from the original module:
B4X:
Dim var As String
var = setvarstring(var)
Log(var) 'This should be = something can i do that ?
Sub setvarstring(avar As String)
Return "something"
End Sub
You cannot do this in the way you illustrate, as I think that you understand (arguments are passed by value). But there are alternative ways to get values into one module from another - global variables are the obvious one, but using a class object with properties (which are in fact subroutines in another module) is often a better scheme.