Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Call-a-function/REXX/call-a-function-3.rexx
Normal file
18
Task/Call-a-function/REXX/call-a-function-3.rexx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*╔════════════════════════════════════════════════════════════════════╗
|
||||
║ Calling a function with optional arguments. ║
|
||||
║ ║
|
||||
║ Note that not passing an argument isn't the same as passing a null ║
|
||||
║ argument (a REXX variable whose value is length zero). ║
|
||||
╚════════════════════════════════════════════════════════════════════╝*/
|
||||
|
||||
x= 12; w= x/2; y= x**2; z= x//7 /* z is x modulo seven. */
|
||||
say 'sum of w, x, y, & z=' SumIt(w,x,y,,z) /*pass five args, the 4th arg is "null"*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
|
||||
SumIt: procedure
|
||||
$= 0 /*initialize the sum to zero. */
|
||||
do j=1 for arg() /*obtain the sum of a number of args. */
|
||||
if arg(j,'E') then $= $ + arg(j) /*the Jth arg may have been omitted. */
|
||||
end /*j*/
|
||||
|
||||
return $
|
||||
Loading…
Add table
Add a link
Reference in a new issue