04-24-2022, 05:05 PM
(This post was last modified: 04-24-2022, 05:09 PM by James D Jarvis.)
I tried to trim the quotes to make it easier to read. I might have done that.
That is new to QB64, arguments in a Sub or Function were passed by what they call ByValue in older versions of QB but QB64 does them ByRef. So if you are going to change a variable value it is best to copy the incoming value into a variable for the Sub to work with and leave the incoming variable alone after.
[/quote]
OH... I hadn't noted that in documentation. That explains a few other subroutines and functions that have been driving me crazy the past few days. Well.... fixing those just got a heck of a lot easier too.
(04-24-2022, 04:56 PM)bplus Wrote:(04-24-2022, 04:50 PM)James D Jarvis Wrote: [quote pid="659" dateline="1650816800"]
Values passed to a sub retain any changes made in that sub.
Which I thought shouldn't happen unless the variables were explicitly shared or were returned as part of a function call. Darn it really has been ages since I used QB.
That is new to QB64, arguments in a Sub or Function were passed by what they call ByValue in older versions of QB but QB64 does them ByRef. So if you are going to change a variable value it is best to copy the incoming value into a variable for the Sub to work with and leave the incoming variable alone after.
[/quote]
OH... I hadn't noted that in documentation. That explains a few other subroutines and functions that have been driving me crazy the past few days. Well.... fixing those just got a heck of a lot easier too.