Swapping two variables without using a temp. variable

[Autolink] Menu

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;


[Back: Using parse to split a string]
[Next: Get the first and the last char of a string]