Original Summary

C# 15 (in preview with .NET 11) lets break and continue target an outer loop by label:<p>outer: for (int x = 0; x &lt; xMax; x++) {<p><pre><code> for (int y = 0; y &lt; yMax; y++) { if (ShouldSkipRest(x, y)) continue outer; if (ShouldExitAll(x, y)) break outer; }</code></pre> }<p>Honestly, &quot;goto&quot; never even comes to mind when I write an algorithm. I find it hard to follow, so when I need to leave nested loops I extract a method and &quot;return&quot; instead.<p>Do you use &quot;goto&quot; in real code? Do you think you&#x27;ll use labeled break&#x2F;continue?<p>https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;csharp&#x2F;whats-new&#x2F;csharp-15#labeled-break-and-continue


  • 情报分类:商业与市场研究
  • 分类依据:内容涉及商业、投资或市场动态
  • 信息来源:Hacker News 新项目
  • 发布时间:2026/10/14 23:18:05