buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Loop labels

Open giann opened this issue 2 years ago • 2 comments

To allow breaking outer loops:

while :outer (true) {
    while (true) {
        break outer;
    }
}

giann avatar Oct 02 '23 09:10 giann

Because I think this project is drawing inspiration from zig I think it should just be the same as zig Labeled-while

outer: while (true) {
  while (true) {
    if (mabe_break_inner_loop) break;
    if (mabe_break_outer_loop) break :outer;
  }
}

kfird214 avatar Oct 03 '23 17:10 kfird214

buzz is not really inspired by zig even though it's implemented with it. It takes more from Dart, Swift and Lua (for its architecture).

I think that starting with the label let it seem like a label could appear anywhere.

giann avatar Oct 03 '23 17:10 giann