Fix my very very silly mistake of makeing keys and values the same type in map, also add a map.for_each function
This commit is contained in:
@@ -6,3 +6,8 @@
|
||||
2
|
||||
30
|
||||
4
|
||||
Lookie, a map!
|
||||
What I get for not testing different types
|
||||
key: 7, value: Lookie, a map!
|
||||
key: 20, value: What I get for not testing different types
|
||||
key: 30, value: we'll look for for_each too
|
||||
|
||||
@@ -16,5 +16,11 @@ fun main():int {
|
||||
println(m[2])
|
||||
println(m[6])
|
||||
println(m[3])
|
||||
var mapEx = map(7, "Lookie, a map!")
|
||||
mapEx[20] = "What I get for not testing different types"
|
||||
mapEx[30] = "we'll look for for_each too"
|
||||
println(mapEx[7])
|
||||
println(mapEx[20])
|
||||
mapEx.for_each(fun(key:int, value:char*) { print("key: "); print(key); print(", value: "); println(value); })
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user