June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,19 +1,19 @@
|
|||
mydict = [ "hello"=>13, "world"=>31, "!"=>71 ]
|
||||
dict = Dict("hello" => 13, "world" => 31, "!" => 71)
|
||||
|
||||
# applying a function to key-value pairs:
|
||||
map(println, mydict);
|
||||
foreach(println, dict)
|
||||
|
||||
# iterating over key-value pairs:
|
||||
for (key,value) in mydict
|
||||
println("key = $key, value = $value")
|
||||
for (key, value) in dict
|
||||
println("dict[$key] = $value")
|
||||
end
|
||||
|
||||
# iterating over keys:
|
||||
for key in keys(mydict)
|
||||
println("key = $key")
|
||||
for key in keys(dict)
|
||||
@show key
|
||||
end
|
||||
|
||||
# iterating over values:
|
||||
for value in values(mydict)
|
||||
println("value = $value")
|
||||
for value in values(dict)
|
||||
@show value
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue