Files
pplus-web/mojo/probes/dict-order.mojo
T
2026-10-05 03:03:38 +00:00

13 lines
308 B
Mojo

# probe: does a Dict iterate in insertion order, and after a pop and re-insert?
def main() raises:
var d = Dict[Int, String]()
d[3] = "c"
d[1] = "a"
d[2] = "b"
for k in d.keys():
print(k)
_ = d.pop(1)
d[1] = "a again"
for e in d.items():
print(e.key, e.value)