Files
kraken/tests/test_map.krak

28 lines
627 B
Plaintext
Raw Normal View History

import io:*
import map:*
fun main(): int {
var m = map(3,1)
m.set(2,2)
m.set(1,3)
println(m[1])
println(m[2])
println(m[3])
m.set(3,4)
m.set(4,20)
m[6] = 30
println(m[1])
println(m[4])
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.remove(20)
mapEx.for_each(fun(key:int, value:*char) { print("key: "); print(key); print(", value: "); println(value); })
return 0
}