Main Help → GENerel Reference → Local Command
The Local command is used to designate selected variables in a subroutine as local variables. The calling format is
Local #1,#2,...#n
where #1,#2,...,#n are any number of valid variable names. See information on subroutines for more detail on scoping of variables within subroutines.
Note that defining array variables as locals requires explicitly listing each one. To make the task easier, you can specify a range to be made local with two indices separated by '-'. For example, if a subroutine uses #m[0], #m[1], #m[2], ... variables, the Local commands would be need to include all that are needed as locals or a range of those needed as locals, such as:
Local #m[0],#m[2],#m[4-10],#m[23]
Using just the command Local #m makes only #m a local variable while the array variables remain global. Including only some of an array makes some local and leaves the rest global (the option to use a range of indices since 3.5/1.0).
Local commands can only be in subroutines.Local commands but they must all be the first commands in the subroutine.