Variable as a reference or value to a function
#15
The reason your initial code passes by value to the sub is the use of double brackets
Call MySub(a) ' passes reference to a
Call MySub((a)) ' evaluates (a) to tempvalue and passes reference to tempvalue

(Same is true for Functions btw)

btw i prefer to write (and read):
MySub a 'byref
MySub (a) 'byval
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply


Messages In This Thread
RE: Variable as a reference or value to a function - by mdijkens - 07-18-2022, 03:38 PM



Users browsing this thread: 11 Guest(s)