02-23-2025, 11:49 PM
When I run the following program:
I get the following output:
a$ as assigned=Hello
value within the sub=Hello
a$ AFTER sub=Hello world
a$ as assigned=Hello
value within the sub=Hello col=10 row=10 height=1 len=50
a$ AFTER sub=Hello
The first instance works as expected - I assign a$, pass it to the sub, alter the value, and upon return it has retained the changed from the Sub.
BUT...why is it that when I pass a$ with a static string, I get all of that value passed to the Sub (Hello col=10 row=10 height=1 len=5), but I cannot retain any changes when we return from the Sub ? Regardless of what I change g$ to in the sub it always reverts back to Hello.
Code: (Select All)
a$ = "Hello"
Print "a$ as assigned="; a$
abc a$
Print "a$ AFTER sub="; a$
Print
a$ = "Hello"
Print "a$ as assigned="; a$
abc a$ + " col=10 row=10 height=1 len=50"
Print "a$ AFTER sub="; a$
Sub abc (g$)
Print "value within the sub="; g$
g$ = g$ + " world"
End Sub
I get the following output:
a$ as assigned=Hello
value within the sub=Hello
a$ AFTER sub=Hello world
a$ as assigned=Hello
value within the sub=Hello col=10 row=10 height=1 len=50
a$ AFTER sub=Hello
The first instance works as expected - I assign a$, pass it to the sub, alter the value, and upon return it has retained the changed from the Sub.
BUT...why is it that when I pass a$ with a static string, I get all of that value passed to the Sub (Hello col=10 row=10 height=1 len=5), but I cannot retain any changes when we return from the Sub ? Regardless of what I change g$ to in the sub it always reverts back to Hello.