buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.22k stars 34 forks source link

List with initial size (improved range) #270

Closed giann closed 4 months ago

giann commented 7 months ago

To do this we could expand on the range syntax:

| Regular range
var list = 0..n; | 0, 1, ... n - 1
| List filled with n zeroes
var list = 0.*n; | 0, ... 0
giann commented 4 months ago

Not a clear syntax. Could be achieved with:

var list = (0..n).toList().fill(0);