REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Hints for using Object REXX



This section contains some hints for using the new features in Object 
REXX. 
---------- * ----------

Using more than one variable pointing to a stem 
In Object REXX you can have multiple variables pointing to the same stem.; 
e.g. after issuing 

 
  b. = a.

b. points to the same variable as a.. Note that this is not a copy 
operation -- it's more like a shadow on the WPS. For example if you change 
the value b.4 the value al.4 is also changed: 

 
                    /* first fill the stem a.                         */
  do i = 1 to 10
    a.i = i*i
  end /* do */
                    /* let b. point to the same stem as a.            */
  b. = a.
                    /* change an entry using b.                       */
  b.4 = 17
                    /* examine the fourth entry of a.                 */
  say "a.4 is" a.4
                    /* -> "a.4 is 17"                                 */

BTW: Dropping a. in this example does not discard the variable because b. 
points to the same variable. 
---------- * ----------

  

Inf-HTML End Run - Successful