Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -1 +0,0 @@
|
|||
associative$[][] = [ [ 1 "associative" ] [ 2 "arrays" ] ]
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
proc indexAssoc index . array[][] item .
|
||||
for i = 1 to len array[][]
|
||||
if array[i][1] = index
|
||||
item = array[i][2]
|
||||
break 2
|
||||
.
|
||||
.
|
||||
item = number "nan"
|
||||
.
|
||||
proc indexStrAssoc index$ . array$[][] item$ .
|
||||
for i = 1 to len array$[][]
|
||||
if array$[i][1] = index$
|
||||
item$ = array$[i][2]
|
||||
break 2
|
||||
.
|
||||
.
|
||||
item$ = ""
|
||||
.
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# use array of array for this
|
||||
proc hashGet ind$ . ar$[][] item$ .
|
||||
for i to len ar$[][]
|
||||
if ar$[i][1] = ind$
|
||||
item$ = ar$[i][2]
|
||||
return
|
||||
.
|
||||
.
|
||||
item$ = ""
|
||||
.
|
||||
proc hashSet ind$ val$ . ar$[][] .
|
||||
for i to len ar$[][]
|
||||
if ar$[i][1] = ind$
|
||||
ar$[i][2] = val$
|
||||
return
|
||||
.
|
||||
.
|
||||
.
|
||||
clothing$[][] = [ [ "type" "t-shirt" ] [ "color" "red" ] ]
|
||||
clothing$[][] &= [ "size" "xl" ]
|
||||
#
|
||||
hashSet "color" "green" clothing$[][]
|
||||
hashGet "color" clothing$[][] col$
|
||||
print col$
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
var hash = Hash.new(
|
||||
var hash = Hash(
|
||||
key1 => 'value1',
|
||||
key2 => 'value2',
|
||||
);
|
||||
)
|
||||
|
||||
# Add a new key-value pair
|
||||
hash{:key3} = 'value3';
|
||||
hash{:key3} = 'value3'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue