RosettaCodeData/Task/Associative-array-Iteration/Haxe/associative-array-iteration...

19 lines
303 B
Plaintext

class Main {
static public function main() {
var map = [1 => "one", 2 => "two"];
// key and value
for (key => value in map) {
trace(key + " " + value);
}
// keys only
for (key in map.keys())
trace(key);
// values only
for (value in map)
trace(value);
}
}