Associative array/Creation: Difference between revisions

no edit summary
(Remove leftover unrelated text)
No edit summary
Line 416:
for key, value in d.iteritems():
print key, value
 
==[[Raven]]==
[[Category:Raven]]
 
{ 'a' 1 'b' 2 'c' 3.14 'd' 'xyz' } as a_hash
a_hash print
 
hash (4 items)
a => 1
b => 2
c => 3.14
d => "xyz"
 
a_hash 'c' get # get key 'c'
6.28 a_hash 'c' set # set key 'c'
a_hash.'c' # get key 'c' shorthand
6.28 a_hash:'c' # set key 'c' shorthand
 
Null is returned for unknown keys.
 
==[[Ruby]]==
Anonymous user