Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -1,13 +1,5 @@
|
|||
associative$[][] = [ [ 1 "associative" ] [ 2 "arrays" ] ]
|
||||
print "Key-value pairs:"
|
||||
for i = 1 to len associative$[][]
|
||||
print associative$[i][1] & " " & associative$[i][2]
|
||||
.
|
||||
print "Just keys:"
|
||||
for i = 1 to len associative$[][]
|
||||
print associative$[i][1]
|
||||
.
|
||||
print "Just values:"
|
||||
for i = 1 to len associative$[][]
|
||||
print associative$[i][2]
|
||||
# use array of array for this
|
||||
clothing$[][] = [ [ "type" "t-shirt" ] [ "color" "red" ] [ "size" "xl" ] ]
|
||||
for i to len clothing$[][]
|
||||
print clothing$[i][1] & ": " & clothing$[i][2]
|
||||
.
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
var hash = Hash.new(
|
||||
var hash = Hash(
|
||||
key1 => 'value1',
|
||||
key2 => 'value2',
|
||||
)
|
||||
|
||||
# Iterate over key-value pairs
|
||||
hash.each { |key, value|
|
||||
say "#{key}: #{value}";
|
||||
say "#{key}: #{value}"
|
||||
}
|
||||
|
||||
# Iterate only over keys
|
||||
hash.keys.each { |key|
|
||||
say key;
|
||||
say key
|
||||
}
|
||||
|
||||
# Iterate only over values
|
||||
hash.values.each { |value|
|
||||
say value;
|
||||
say value
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue