This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -0,0 +1,17 @@
animal = 'dog'
if animal = 'cat' then say animal "is lexically equal to cat"
if animal \= 'cat' then say animal "is not lexically equal cat"
if animal > 'cat' then say animal "is lexically higher than cat"
if animal < 'cat' then say animal "is lexically lower than cat"
if animal >= 'cat' then say animal "is not lexically lower than cat"
if animal <= 'cat' then say animal "is not lexically higher than cat"
/*The above comparative operators do not consider */
/*leading and trailing whitespace when making comparisons.*/
if ' cat ' = 'cat' then say "this will print because whitespace is stripped"
/*To consider any whitespace in a comparison, */
/*we need to use strict comparative operators.*/
if ' cat ' == 'cat' then say "this will not print because comparison is strict"

View file

@ -0,0 +1,23 @@
/* REXX ***************************************************************
* 16.05.2013 Walter Pachl
**********************************************************************/
Call test 'A','<','a'
Call test 'A','=',' a'
Call test 'A','==',' a'
Call test 'Walter','<',' Wolter'
Exit
test: Procedure
Parse Arg o1,op,o2
Say q(o1) op q(o2) '->' clcompare(o1,op,o2)
Return
clcompare: Procedure
/* caseless comparison of the operands */
Parse Arg opd1,op,opd2
opd1u=translate(opd1)
opd2u=translate(opd2)
Interpret 'res=opd1u' op 'opd2u'
Return res
q: Return '"'arg(1)'"'