REDOXODER,
I tested the code. I am not sure what you are trying to achieve. Are you trying to print toto then titi?
Here the code that I modified to get that.
a$="toto"
for b = 1 to 30
print a$
modif()
wait 50
next a
function modif()
a$="titi"
print a$
endfunction
As for global and functions. I wouldn't mess around with Global stuff. It's used little in real programming applications. There's only a few instances where it is really needed. The code that you gave did run, but it printed Titi in an infinite loop. So you did achieve changing the value, but I am still not sure what you wanted to do there.
Here is my theory.
If you use globals, use gosubs
If you use functions do everything locally with returning values. That is how functions work. If we got referencing, you can pass the address of the variable that you want to change directly to the function and change it there without having to return the value. Of course that approach can get bad if you don't manage your memory correctly. Plus it is possible if you edit the wrong bit/byte you could crash your computer. That's why I use very little referencing in my C++ programs, but from time to time I am required to use it. I take care in my programming.
Plus a$ is a string not an array. Big difference. Remove the global a$ and the only thing that would print is toto. Otherwise by leaving in global a$ would make it global.
The code above proves my point.
Thanks.
SoulMan
I am my own and own my am I