HaxeFoundation / haxe.org-comments

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

[code.haxe.org] Beginner - Using lists #36

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Using lists - Beginner - Haxe programming language cookbook

In Haxe, the List type represents a linked-list of elements.

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

nsmarkop commented 4 years ago

The code with the following doesn't appear to be valid:

var listOfInts = new List<Int>(1,2,3,4,5);

At least that's the case with the current versions of Haxe (4.0) as it outputs an error of Too many arguments. 10.2.3 in the manual for List says that unlike Array, a List cannot be initialized so I'm guessing that's the issue here and you need to use a loop to populate it.

RealyUniqueName commented 4 years ago

Fixed. Thanks.