`break` in switch `default` case now incorrectly exits surrounding structures.
Closed this issue · 0 comments
TypicWhisper commented
Describe the bug
break
in a switch's default case will exit out of surrounding loops instead of the switch statement.
If there are no surrounding loops, it functions as expected.
To Reproduce
for(I=1,5){
switch(I){
case 1,
print(I+": case")
break
default,
if(I == 2){
print(I+": break")
break # This exits out of the loop
}
print(I+": default")
}
}
This prints:
1: case
2: break
It should print:
1: case
2: break
3: default
4: default
5: default
Expected behavior
The break
should act like it does for case
, exiting the switch statement