RosettaCodeData/Task/Logical-operations/NetRexx/logical-operations.netrexx
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

37 lines
1.1 KiB
Text

/* NetRexx */
options replace format comments java crossref symbols binary
runSample(arg)
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method logicalOperation(xL = boolean, xR = boolean) public static
say showBool(xL) 'AND' showBool(xR) '=' showBool(xL & xR) -- AND
say showBool(xL) 'OR ' showBool(xR) '=' showBool(xL | xR) -- OR
say showBool(xL) 'XOR' showBool(xR) '=' showBool(xL && xR) -- XOR
say ' ' 'NOT' showBool(xL) '=' showBool(\xL) -- NOT
say
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method showBool(bb = boolean) public static
if bb then bt = 'true '
else bt = 'false'
return bt
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
TRUE_ = (1 == 1)
FALSE_ = \TRUE_
lpairs = [ -
[TRUE_, TRUE_ ], -
[TRUE_, FALSE_], -
[FALSE_, TRUE_ ], -
[FALSE_, FALSE_] -
]
loop lx = 0 to lpairs.length - 1
lpair = lpairs[lx]
--say showBool(lpair[0]) showBool(lpair[1])
logicalOperation(lpair[0], lpair[1])
end lx
return