Anonymous user
Order two numerical lists: Difference between revisions
→{{header|REXX}}: corrected program, changed comments, simplified conversion of answer to a glyph.
(Add Nimrod) |
(→{{header|REXX}}: corrected program, changed comments, simplified conversion of answer to a glyph.) |
||
Line 897:
This R<tt>EXX</tt> example uses the same lists as <tt> BBC BASIC. </tt>
<lang rexx>/*REXX pgm finds if list1<list2 (both contain nums), returns true|false.*/
@. =
@.1 = 1 2 1 5 2
@.2 = 1 2 1 5 2 2
@.3 = 1 2 3 4 5
@.4 = 1 2 3 4 5 /* [↓] compare list to previous.*/
if
say right('['@.p"]", 40) is '['@.j"]"; say
end /*i*/ /* [↑] display (+ a blank line)*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────FNORDER subroutine──────────────────*/
FNorder: procedure; parse arg x,y; wx=words(x);
do
else if a>b then return 'false'
end /*k*/
if wx<wy then return 'true'
return 'false'</lang>
'''output'''
<pre>
[1 2 1 5 2] < [1 2 1 5 2 2]
[1 2 1 5 2 2] < [1 2 3 4 5]
[1 2 3 4 5] ≥ [1 2 3 4 5]
</pre>
|