While studying Javascript and Query I came across variables within and outside functions, I have both Hands on Dark Basic Pro books and recall something similar and thought hey lets give this a go...
So I am sharing this in case anybody has a need for such a concoction...
the rest of this post is inside the code in comments...
// First we setup a string variable and pass a string to it
message$ = "Outside the function"
// Next we begin our DO : LOOP which will perform some repeat magic
DO
// Then we print our first setup variable
PRINT message$
// And then we call our function based variable of the same name to be printed onto the screen
printmessage()
// Below we close our DO with a LOOP call
LOOP
// Below we setup our function which features a same name variable as our original variable
FUNCTION printmessage()
// Here we define the same variable as before however this has a different string placed within it
message$ = "Inside the function"
// Here we setup a call the function performs when it is called in the main loop
print message$
// And this ends the boundary of the function
ENDFUNCTION
// Now press F5 for some magic
This is my first code snippet and I hope to post more in the near future but I hope this helps others understand the fundamentals of Variables
EDIT
Fixed a typo in a comment
EDIT
I always misspell separate, can a mod please if they come across this change the spelling in the title... thanks.