Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,10 +1,10 @@
|
|||
/*REXX program shows how to set/display values for an associative array.*/
|
||||
/*┌────────────────────────────────────────────────────────────────────┐
|
||||
│ The (below) two REXX statements aren't really necessary, but it │
|
||||
│ The (below) two REXX statements aren't really necessary, but it │
|
||||
│ shows how to define any and all entries in a associative array so │
|
||||
│ that if a "key" is used that isn't defined, it can be displayed to │
|
||||
│ indicate such, or its value can be checked to determine if it has │
|
||||
│ been set. │
|
||||
│ indicate such, or its value can be checked to determine if a │
|
||||
│ particular associative array element has been set (defined). │
|
||||
└────────────────────────────────────────────────────────────────────┘*/
|
||||
stateF.=' [not defined yet] ' /*sets any/all state former caps.*/
|
||||
stateN.=' [not defined yet] ' /*sets any/all state names. */
|
||||
|
|
@ -12,13 +12,11 @@ stateN.=' [not defined yet] ' /*sets any/all state names. */
|
|||
│ In REXX, when a "key" is used, it's normally stored (internally) │
|
||||
│ as uppercase characters (as in the examples below). Actually, any │
|
||||
│ characters can be used, including blank(s) and non-displayable │
|
||||
│ characters (including '00'x, 'ff'x, commas, periods, quotes, ...).│
|
||||
│ characters (including '00'x, 'ff'x, commas, periods, quotes, ···).│
|
||||
└────────────────────────────────────────────────────────────────────┘*/
|
||||
stateL='' /*list of states (empty now). */
|
||||
/*nice to be in alphabetic order,*/
|
||||
/*they'll be listed in this order*/
|
||||
/*With a little more code, they */
|
||||
/* could be sorted quite easily.*/
|
||||
stateL='' /*list of states (empty now). It's nice to be in alpha-*/
|
||||
/*betic order; they'll be listed in this order. With a */
|
||||
/*little more code, they could be sorted quite easily. */
|
||||
|
||||
call setSC 'al', "Alabama" ,'Tuscaloosa'
|
||||
call setSC 'ca', "California" ,'Benicia'
|
||||
|
|
@ -46,14 +44,14 @@ call setSC 'sc', "South Carolina" ,'Charlestown'
|
|||
call setSC 'tn', "Tennessee" ,'Murfreesboro'
|
||||
call setSC 'vt', "Vermont" ,'Windsor'
|
||||
|
||||
do j=1 for words(stateL) /*list all capitals that were set*/
|
||||
q=word(stateL,j)
|
||||
say 'the former capital of ('q")" stateN.q "was" stateC.q
|
||||
end /*j*/
|
||||
do j=1 for words(stateL) /*show all capitals that were set*/
|
||||
q=word(stateL,j) /*get the next state in the list.*/
|
||||
say 'the former capital of ('q") " stateN.q " was " stateC.q
|
||||
end /*j*/ /* [↑] display states defined. */
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*─────────────────────────────────────setSC subroutine─────────────────*/
|
||||
setSC: arg code; parse arg ,name,cap /*get upper code, get name & cap.*/
|
||||
stateL=stateL code /*keep a list of all state codes.*/
|
||||
stateN.code=name /*set the state's name. */
|
||||
stateC.code=cap /*set the state's capital. */
|
||||
return
|
||||
return /*return to invoker, SET is done.*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue