Variable as a reference or value to a function
#20
Does not work for strings


Code: (Select All)
x$ = "3"
subproc x$
Print "passed byref:"; x$ ' prints 4

x$ = "3"
subproc (x$)
Print "passed byval:"; x$ ' prints 3

x$ = "3"
Call subproc(x$)
Print "passed byref:"; x$ ' prints 4

x$ = "3"
Call subproc((x$))
Print "passed byval:"; x$ ' prints 3

End

Sub subproc (a$)
    a$ = _Trim$(Str$(Val(a$) + 1))
End Sub
b = b + ...
Reply


Messages In This Thread
RE: Variable as a reference or value to a function - by bplus - 08-08-2022, 03:20 PM



Users browsing this thread: 4 Guest(s)