globalscope vs local variables
Just a snippet of information that I have not seen written into the documentation it might be useful to someone when debugging. I accidentally declared a variable both globalscope and localy it works in the following way.
If a variable is declared globalscope and a variable of the same name is declared locally, the local variable takes precedence in it's function and changes to the value of that variable in it's function, only affects the local version of that variable, the global version remains unchanged. This was the cause of a bug that took me all day to find :(
Yes what i did was bad practice, I dont think I'll be making that mistake again lol
Just a snippet of information that I have not seen written into the documentation it might be useful to someone when debugging. I accidentally declared a variable both globalscope and localy it works in the following way.
If a variable is declared globalscope and a variable of the same name is declared locally, the local variable takes precedence in it's function and changes to the value of that variable in it's function, only affects the local version of that variable, the global version remains unchanged. This was the cause of a bug that took me all day to find :(