forked from Mirror/wren
- Remove List.new(_). I was convinced by the issue discussion that using it is probably a bad idea. We don't want to encourage more nulls in the world than there are already are. So let's see if we can live without it and just have List.filled(). That way users think about what they're creating a list *of*. - Added some more tests. - Correctly handle being given a negative size.
9 lines
257 B
Plaintext
9 lines
257 B
Plaintext
var list = List.filled(3, "value")
|
|
System.print(list.count) // expect: 3
|
|
System.print(list) // expect: [value, value, value]
|
|
|
|
// Can create an empty list.
|
|
list = List.filled(0, "value")
|
|
System.print(list.count) // expect: 0
|
|
System.print(list) // expect: []
|