A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,3 @@
|
|||
exit
|
||||
|
||||
exit expression
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
return
|
||||
|
||||
return expression
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
signal on error
|
||||
signal on failure
|
||||
signal on halt
|
||||
signal on lostdigits
|
||||
signal on notready
|
||||
signal on novalue
|
||||
signal on syntax
|
||||
|
||||
signal off error
|
||||
signal off failure
|
||||
signal off halt
|
||||
signal off lostdigits
|
||||
signal off notready
|
||||
signal off novalue
|
||||
signal off syntax
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
signal on novalue
|
||||
∙
|
||||
∙
|
||||
x=oopsay+1
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
novalue: say
|
||||
say '*** error! ***'
|
||||
say
|
||||
say 'undefined REXX variable' condition("D")
|
||||
say
|
||||
say 'in line' sigl
|
||||
say
|
||||
say 'REXX source statement is:'
|
||||
say sourceline(sigl)
|
||||
say
|
||||
exit 13
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
do j=1 to 10
|
||||
say 'j=' j
|
||||
if j>5 then leave
|
||||
say 'negative j=' -j
|
||||
end
|
||||
say 'end of the DO loop for j.'
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
ouch=60
|
||||
sum=0
|
||||
|
||||
do k=0 to 100 by 3
|
||||
say 'k=' k
|
||||
|
||||
do m=1 to k
|
||||
if m=ouch then leave k
|
||||
sum=sum+m
|
||||
end
|
||||
|
||||
end
|
||||
say 'sum=' sum
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
sum=0
|
||||
|
||||
do j=1 to 1000
|
||||
if j//3==0 | j//7==0 then iterate
|
||||
sum=sum+j
|
||||
end
|
||||
|
||||
/*shows sum of 1k numbers except those divisible by 3 or 7.*/
|
||||
say 'sum='sum
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
numeric digits 5000
|
||||
prod=0
|
||||
|
||||
do k=1 to 2000
|
||||
|
||||
do m=1 to k
|
||||
if m>99 then iterate k
|
||||
prod=prod*m
|
||||
end
|
||||
|
||||
end
|
||||
say 'prod=' prod
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
numeric digits 1000 /*prepare for some gihugeic numbers.*/
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
n=4
|
||||
call factorial n
|
||||
say n'!=' result
|
||||
exit
|
||||
|
||||
|
||||
factorial: parse arg x
|
||||
!=1
|
||||
|
||||
do j=2 to x
|
||||
!=!*j
|
||||
end
|
||||
|
||||
return !
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
∙
|
||||
∙
|
||||
∙
|
||||
prod=1
|
||||
a=7 /*or somesuch.*/
|
||||
b=3 /* likewise. */
|
||||
|
||||
op='**' /*or whatever.*/
|
||||
∙
|
||||
∙
|
||||
∙
|
||||
select
|
||||
when op=='+' then r=a+b /*add. */
|
||||
when op=='-' then r=a-b /*subtract. */
|
||||
when op=='*' then do; r=a*b; prod=prod*r; end /*multiply.*/
|
||||
when op=='*' then r=a*b /*multiply. */
|
||||
when op=='/' & b\=0 then r=a/b /*divide. */
|
||||
when op=='%' & b\=0 then r=a/b /*interger divide. */
|
||||
when op=='//' & b\=0 then r=a/b /*modulus (remainder). */
|
||||
when op=='||' then r=a||b /*concatenation. */
|
||||
when op=='caw' then r=xyz(a,b) /*call the XYZ subroutine*/
|
||||
otherwise r='[n/a]' /*signify not applicable.*/
|
||||
end
|
||||
|
||||
say 'result for' a op b "=" r
|
||||
Loading…
Add table
Add a link
Reference in a new issue