REXX Tips & Tricks, Version 2.80


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


Swapping two variables without using a temp. variable



Use the <PARSE instruction to swap the values of two variables without 
using a temporary variable: 

 
/* sample code to swap the values of two variables using PARSE        */

  var1=44
  var2=55
  parse value var1 var2 with var2 var1;

/* use a separator character if the values contain blanks             */
  var1=44 66
  var2=55 77
  parse value var1 || "00"x || var2 with var2 "00"x var1;


  

Inf-HTML End Run - Successful