Rexx Programming/Example Code

Hello World:
Code:

Output: Hello World

Uniq:
Usage: uniq < filename  or  cat filename | uniq

Shows that stem variables may be indexed by strings

as well as numbers. I use it as an improved version of

the unix 'uniq' program.

Code:
/* Show only one copy of each line in a whole file */

seen. = 0                                 /* a stem variable */

Do While Lines > 0                /* read input lines until no more */

Parse Pull this_line                  /* get a line */

If seen.this_line Then Iterate /* use the line as an index, and if seen (value of 1), loop to get next line */

Say this_line                         /* If it's a previously unseen line, indicate we've now seen it */

end