buzz-language / buzz

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

Using range expression in `foreach` statement should not create a list #170

Closed giann closed 3 months ago

giann commented 10 months ago

Ranges are syntaxic sugar to create list of integers. But when used in a foreach statement it should be expanded to a classic for statement:

foreach (int i in 0...n) {
    | ...
}

should be syntaxic sugar for:

for (int i = 0; i < n; i = i + 1) {
    | ...
}