Files
wren/test/core/map/count.wren
T

13 lines
337 B
Plaintext
Raw Normal View History

2015-01-24 23:21:50 -08:00
var map = {}
2015-09-15 07:46:09 -07:00
System.print(map.count) // expect: 0
2015-01-24 22:27:35 -08:00
map["one"] = "value"
2015-09-15 07:46:09 -07:00
System.print(map.count) // expect: 1
2015-01-24 22:27:35 -08:00
map["two"] = "value"
2015-09-15 07:46:09 -07:00
System.print(map.count) // expect: 2
2015-01-24 22:27:35 -08:00
map["three"] = "value"
2015-09-15 07:46:09 -07:00
System.print(map.count) // expect: 3
2015-01-24 22:27:35 -08:00
// Adding existing key does not increase count.
map["two"] = "new value"
2015-09-15 07:46:09 -07:00
System.print(map.count) // expect: 3