Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Optional-parameters/REXX/optional-parameters-1.rexx
Normal file
23
Task/Optional-parameters/REXX/optional-parameters-1.rexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
sortStrings: procedure expose @. /*the stemmed array is named: @. */
|
||||
col= 1 /*set some defaults (here and below). */
|
||||
reverse= 'NO'
|
||||
order= 'LEXICOGRAPHIC'
|
||||
arg options /*obtain the options (in uppercase). */
|
||||
do j=1 for words(options) /*examine all the words (options). */
|
||||
x= word(options, j)
|
||||
select
|
||||
when datatype(x, 'W') then col= x / 1 /*normalize the number. */
|
||||
when pos('=', x)==0 then order= x /*has it an equal sign? */
|
||||
otherwise parse var x nam '=' value /*get value.*/
|
||||
end /*select*/
|
||||
end /*j*/
|
||||
|
||||
/*╔═══════════════════════════════════════════════════════════╗
|
||||
║ check for errors here: COL isn't a positive integer ···, ║
|
||||
║ REVERSE value isn't NO or YES, ║
|
||||
║ ORDER value is recognized ··· ║
|
||||
╚═══════════════════════════════════════════════════════════╝*/
|
||||
|
||||
... main body of string sort here ...
|
||||
|
||||
return /*stick a fork in it, we're all done. */
|
||||
8
Task/Optional-parameters/REXX/optional-parameters-2.rexx
Normal file
8
Task/Optional-parameters/REXX/optional-parameters-2.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*REXX example uses the SortStrings subroutine with some (passed) optional arguments. */
|
||||
|
||||
|
||||
@.1= 'one'; @.2= "two"; @.3= 'three' /*define an array (@.) of strings here.*/
|
||||
|
||||
|
||||
call sortStrings 'Reverse=no' 3
|
||||
/*stick a fork in it, we're all done. */
|
||||
Loading…
Add table
Add a link
Reference in a new issue