Functions...?

Previous topic - Next topic

ByteByter

Code (glbasic) Select

Global B;B=10

AddOne(B)
Print B,0,0
Showscreen
Mouswait

Function AddOne:A
A=A+1
endfunction


Returns 10, has GLB always been like this? Because In most languages this would modify the variable that was input into the function, changing it's value to 11, and I could have sworn GLB was not like this before.

Using GLB V10.054 Beta.

Minion

If you use the BYREF command, then you can alter the value, otherwise all you are throwing into the function is a copy

ByteByter

Quote from: Minion on 2011-Aug-11
If you use the BYREF command, then you can alter the value, otherwise all you are throwing into the function is a copy
Thanks, I feel stupid, I've been doing this for a while now, and hadn't noticed anything? Well, at least this explains a few errors I've been having with my program