rtulip / haystack

Haystack is a compiled, statically typed, stack-based language with opt-in variable assignment.
MIT License
25 stars 2 forks source link

Change `while` to `while-do` #195

Closed rtulip closed 1 year ago

rtulip commented 1 year ago

Since changing how blocks and bindings work, you can no longer create a temporary binding inside a while loops condition. I also am not a huge fan that the while loop block now has hidden meaning, rather than just being an expression.

I'm thinking about the following:

fn main() {
    0 while {
        as [i] i
        i 10 <
     } do { 
        as [i] 
        i println
        1 +
    }
}
rtulip commented 1 year ago
while true do {
    "loop" println
}