Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Arrays/NetRexx/arrays.netrexx
Normal file
34
Task/Arrays/NetRexx/arrays.netrexx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
array = int[10]
|
||||
array[0] = 42
|
||||
|
||||
say array[0] array[3]
|
||||
say
|
||||
|
||||
words = ['Ogof', 'Ffynnon', 'Ddu']
|
||||
|
||||
say words[0] words[1] words[2]
|
||||
say
|
||||
|
||||
-- Dynamic arrays can be simulated via the Java Collections package
|
||||
splk = ArrayList()
|
||||
splk.add(words[0])
|
||||
splk.add(words[1])
|
||||
splk.add(words[2])
|
||||
splk.add('Draenen')
|
||||
|
||||
say splk.get(0) splk.get(3)
|
||||
say splk.get(0) splk.get(1) splk.get(2)
|
||||
say
|
||||
|
||||
-- or by using NetRexx "indexed strings" (associative arrays)
|
||||
cymru = ''
|
||||
cymru[0] = 0
|
||||
cymru[0] = cymru[0] + 1; cymru[cymru[0]] = splk.get(0) splk.get(1) splk.get(2)
|
||||
cymru[0] = cymru[0] + 1; cymru[cymru[0]] = splk.get(0) splk.get(3)
|
||||
|
||||
loop x_ = 1 to cymru[0] by 1
|
||||
say x_':' cymru[x_]
|
||||
end x_
|
||||
Loading…
Add table
Add a link
Reference in a new issue