mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-20 05:21:26 +02:00
added another dictionary-for-loop example
This commit is contained in:
@@ -269,6 +269,10 @@ for a in ["dog"=>"mammal","cat"=>"mammal","mouse"=>"mammal"]
|
|||||||
println("$(a[1]) is $(a[2])")
|
println("$(a[1]) is $(a[2])")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for (k,v) in ["dog"=>"mammal","cat"=>"mammal","mouse"=>"mammal"]
|
||||||
|
println("$k is $v")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# While loops go until a condition is no longer met.
|
# While loops go until a condition is no longer met.
|
||||||
# prints:
|
# prints:
|
||||||
|
Reference in New Issue
Block a user