There is a Bug (or should i say peculiarity?) that should be know, if you don't want to go in trouble:
Working with subprogram or functions can be fine, if you are knowing this:
If you need a real global-variable, you have to define it bevor every other Line of Code.
Also, every line after the new setting VAR will know this Value (but no Line before )
This can be sometimes nice and sometimes frustrating, because you can't write that you want, there you want. (Besides: Running a subprogram that define the variables will not work.)
Look at this example, that generate the Error ("Duplicate variable in...."):
GOSUB @INI GOSUB @MAIN END @MAIN WHILE BUTTON()!=#X PRINT A WEND RETURN 'END @INI VAR A = "It runs ; let us sell it !" RETURN 'ENDYou see, there is only one Variable, but a Error will showed. That means: SmileBasic ignores, that the Variable should set at the first Sub before the second is started. If you change the order the code will work fine:
GOSUB @INI GOSUB @MAIN END @INI VAR A = "It runs ; let us sell it !" RETURN 'END @MAIN WHILE BUTTON()!=#X PRINT A WEND RETURN 'ENDIf you needed only a temporary variable, you should put your subprogram (or function) on the last line of Code (as it possible). (I have posted this here, because i haven't found a description of this simple problem.) Used Smile-Basic Version: 3.6.0 (Europe-Version)