2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,12 +1,16 @@
|
|||
/*REXX programs demonstrates short-circuit evaulation testing. */
|
||||
/*REXX programs demonstrates short-circuit evaluation testing (in an IF statement).*/
|
||||
parse arg LO HI . /*obtain optional arguments from he CL.*/
|
||||
if LO=='' | LO=="," then LO= -2 /*Not specified? Then use the default.*/
|
||||
if HI=='' | HI=="," then HI= 2 /* " " " " " " */
|
||||
|
||||
do i=-2 to 2
|
||||
x=a(i) & b(i)
|
||||
y=a(i)
|
||||
if \y then y=b(i)
|
||||
say copies('─',30) 'x='||x 'y='y 'i='i
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────subroutines─────────────────────────*/
|
||||
a: say 'A entered with:' arg(1);return abs(arg(1)//2) /*1=odd, 0=even */
|
||||
b: say 'B entered with:' arg(1);return arg(1)<0 /*1=neg, 0=if not*/
|
||||
do j=LO to HI /*process from the low to the high.*/
|
||||
x=a(j) & b(j) /*compute function A and function B */
|
||||
y=a(j) | b(j) /* " " " or " " */
|
||||
if \y then y=b(j) /* " " B (for negation).*/
|
||||
say copies('═', 30) ' x=' || x ' y='y ' j='j
|
||||
say
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
a: say ' A entered with:' arg(1); return abs( arg(1) // 2) /*1=odd, 0=even */
|
||||
b: say ' B entered with:' arg(1); return arg(1) < 0 /*1=neg, 0=if not*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue