HaxeFoundation / haxe.org-comments

Repository to collect comments of our haxe.org websites
2 stars 2 forks source link

[code.haxe.org] Beginner - Using maps #7

Open utterances-bot opened 5 years ago

utterances-bot commented 5 years ago

Using maps - Beginner - Haxe programming language cookbook

In Haxe, Map (also known as dictionary) allows key to value mapping for arbitrary value types and many key types.

https://code.haxe.org/category/beginner/maps.html

crazyjat commented 5 years ago

There is an error.

var keys = [for(key in map.keys() key] should be var keys = [for(key in map.keys()) key]

markknol commented 5 years ago

@crazyjat thanks, I've just updated that.

ratkingsminion commented 5 years ago

Is there a(n easy) way to clear a Map?

markknol commented 5 years ago

for (key in map.keys()) map.remove (key);

pfoof commented 3 years ago

Is there any easy way to see if the Map is empty? I can technically use !keys().hasNext() but wouldn't it be worth adding Map.isEmpty()?

Grape-Boy commented 1 year ago

It says Lamba.array(map) instead of Lambda.array(map) near crazyjat's correction