Can't create global variables inside function per documentation
Posted: 16 Jan 2017, 00:42
From the documentation:
The messagebox is blank.
The only way to do it is to define variable as global in the autoexecute section, but that is untidy and difficult to keep track of. I only want to declare global variables inside the function I am working in. Is there any way to do it?
However I am finding neither of these methods work. Here is an example:Global variables
To refer to an existing global variable inside a function (or create a new one), declare the variable as global prior to using it.
Assume-global mode: If a function needs to access or create a large number of global variables, it can be defined to assume that all its variables are global (except its parameters) by making its first line either the word "global" or the declaration of a local variable.
Code: Select all
#Persistent
function1()
function2()
return
function1(){
global variable := 1 ;or global [line feed] variable :=1
}
function2(){
msgbox %variable%
}
The only way to do it is to define variable as global in the autoexecute section, but that is untidy and difficult to keep track of. I only want to declare global variables inside the function I am working in. Is there any way to do it?