Should unassigned labeled break in loops be a compile error?
Ziggit
Should unassigned labeled break in loops be a compile error?
I ran into this bit of footgun (?) today when writing a nested loop with a labeled break. When writing a loop there are two valid locations to write a label. One to label the loop, so that you can break out of nested loops (brk: for) and one where to identify where to ‘return’ values from when you break out of the loop (for (1..100) |i| brk:). Unfortunately there isn’t a compile error when you use the latter, but don’t assign the value to anything and the loop expression is void. In short both ...
0 comments
No comments yet.