Variable as a reference or value to a function
#13
I will try again:
Code: (Select All)
Dim ALong As Long
Dim BInteger As Integer

BInteger = 1
Print "Binteger is"; BInteger
temp& = passMeALongTypeAndIWillChangeIt&(BInteger)
Print "Binteger after call to Function is"; BInteger; " NOT changed! so effectively passed BInteger by Value"
Print: Print
ALong = 1
Print "Along is"; ALong
temp& = passMeALongTypeAndIWillChangeIt&(ALong)
Print "ALong after call to Function is"; ALong; " changed because ALong is same Type as defined in Function so effectively passed by Reference."

Function passMeALongTypeAndIWillChangeIt& (i As Long)
    i = i * 10
    Print "Inside passMeALongTypeAndIWillChangeIt& i ="; i
    passMeALongTypeAndIWillChangeIt& = whoCares
End Function
b = b + ...
Reply


Messages In This Thread
RE: Variable as a reference or value to a function - by bplus - 07-18-2022, 02:29 PM



Users browsing this thread: 2 Guest(s)