Search code examples
haxe

Arrays in Haxe with multiple types


In Javascript, it's possible to create an array with nested arrays inside it, in a single line of code. Is it possible to do the equivalent in Haxe?

var a = [
    ["This is a nested array"],
    ["This is another nested array"],
    "This is not a nested array"
];

Solution

  • Yes, it is exactly the same syntax in this case and a should be typed as Array<Dynamic>.