Anonymous user
Phrase reversals: Difference between revisions
m
→version 2: changed comments, used a template for the output section.
No edit summary |
m (→version 2: changed comments, used a template for the output section.) |
||
Line 1,775:
===version 2===
<lang rexx>/*REXX program reverses words
parse arg $ /*obtain optional arguments from the CL*/
if $='' then $= "rosetta code phrase reversal" /*Not specified? Then use the default.*/
L=; W= /*initialize two REXX variables to null*/
do j=1 for words($); _= word($, j)
L= L reverse(_); W= _
end /*j*/
say ' the original phrase used: ' $
say ' original phrase reversed: ' reverse($)
say ' reversed individual words: ' strip(L)
say ' reversed words in phrases: ' W /*stick a fork in it, we're all done. */</lang>
<pre>
the original phrase used: rosetta code phrase reversal
|