so when im doing my tutorial ( dev king tutorial) he said its better to set everywhere by every variable "local" is it important to set by every variable "local"?
✓ ANSWER ACCEPTED
is local importand by every variable?
1 answer
✓ Accepted answer
It's generally better to use local variables than using global variables for the simple reason that because the local variables use less performance.
As said in the devforum, because global variables and functions must be accessed by a hash lookup, they can be expensive to use in terms of performance. In fact, a global variable accessed in a time-critical loop can perform 10% slower (or worse) than a local variable in the same loop.
So basically your script runs better.
Still, you still need to know about scopes, because, as you may already know, a local variable declared in a function will have a nil value outside this function
This discussion is preserved as it was. New answers, comments, and votes are closed.
