11-28-2023, 03:41 AM
(11-28-2023, 02:36 AM)SMcNeill Wrote: Thing to remember is that passing via reference only works IF variable types match. For example, change the types from DOUBLE to _FLOAT in the program above.Yep, I explain this method in Lesson 6 of the tutorial here. The code that generates Figure 7 (variablepassing2.bas) is an example of Steve's method.
Best practice, if one doesn't want values to pass by reference, is just to pass to temp variables.
SUB foo(tempX, tempY)
x = tempX: y = tempY
'Now use x/y with zero worry over changing your original variable values.