Product Site

2.30.2. USE LOCAL

USE LOCAL defines local variables in a method.

Generally object variables must be specified in a method using EXPOSE, while all other variables used in the method will become local variables. In contrast to this, USE LOCAL allows to explicitly declare local variables, while all other variables not listed on the USE LOCAL instruction will automatically become object variables.

Each name must be a simple variable name or a stem variable name. A compound variable is not allowed. If no name is specified, all variables will become object variables.

If a USE LOCAL instruction is present, it must be the first instruction of the method.

Note that USE LOCAL will always keep Rexx special variables RC, RESULT, SIGL, SELF, and SUPER as local variables.
Example 2.43. Instructions — USE LOCAL
::method init
use local x y z   -- only x, y, and z are local
                  -- all other become object variables

::method init2
use local         -- any variable is an object variable