You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently one of the biggest headaches I've run into is that break and continue with label aren't translated, and the resulting code is likely incorrect as you would usually only use a label if you wanted to break/continue an outer loop, not the inner-most one. I'm wondering if we could translate break and continue with label to use goto, perhaps. I believe this should work, but let me know your thoughts:
Break-with-label input:
label_1:
while (true) {
while (true) {
breaklabel_1;
}
}
I just did a quick test and it seems to work but I'm worried that I'm missing something. The semicolon after the C# labels are needed to make it a valid label target but they're basically a noop for jumping purposes.
The text was updated successfully, but these errors were encountered:
Interesting. I wasn't aware of labeled breaks/continues in Java.
I am seeing a number of csharplang proposals which would add some type of support for labeled breaks/continues in C# but none of which have moved passed the proposed stage. Seems to be a controversial topic.
Do you mind sharing how you have translated the labeled breaks/continues to goto?
Currently one of the biggest headaches I've run into is that
break
andcontinue
with label aren't translated, and the resulting code is likely incorrect as you would usually only use a label if you wanted to break/continue an outer loop, not the inner-most one. I'm wondering if we could translate break and continue with label to usegoto
, perhaps. I believe this should work, but let me know your thoughts:Break-with-label input:
Break-with-label proposed output:
Continue-with-label input:
Continue-with-label proposed output:
I just did a quick test and it seems to work but I'm worried that I'm missing something. The semicolon after the C# labels are needed to make it a valid label target but they're basically a noop for jumping purposes.
The text was updated successfully, but these errors were encountered: