On 12.06.22 20:14, Charlie-Boo wrote:
>
> How do I write a subroutine that returns an array? I see only QUIT SINGLEVALUE
>
test ; Testroutine
k arr
s arr(1)=123
s arr(3)=333
w "Sum ",$$doubleSum(.arr),! ; <-- notice the dot in front of arr
w arr(1),!
w arr(3),!
q
doubleSum(par)
s par(1)=par(1)*2
s par(3)=par(3)*2
q par(1)+par(3)
A dot in front of an argument(variable) means it's a Call-By-Reference,
without an dot it's a Call-By-Value.
To pass an array to a function (or subroutine) or to get an array back
from a function (or subroutine), you have to use Call-By-Reference.
Hth
--
An old Windows has old security holes.
A new Windows has new security holes.
Another OS has other security holes.
For safety you must care yourself.