<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc" -->

---
title: Labeled break and continue statements in C# 15 | daily.dev
description: C# 15 introduces labeled break and continue statements, allowing developers to exit or continue an outer loop from within a nested loop by referencing a label...
canonical: https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Labeled break and continue statements in C# 15 | daily.dev
og:description: C# 15 introduces labeled break and continue statements, allowing developers to exit or continue an outer loop from within a nested loop by referencing a label...
og:url: https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc
og:image: https://api.daily.dev/og/posts/26e8YRMrC.png
og:image:alt: Labeled break and continue statements in C# 15
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Labeled break and continue statements in C# 15

**[Damir's Corner](https://daily.dev/sources/damirscorner)** · 3 min read · 7 upvotes · 0 comments

## Summary

C# 15 introduces labeled break and continue statements, allowing developers to exit or continue an outer loop from within a nested loop by referencing a label on the outer loop. This provides a clearer, more readable alternative to using goto statements or boolean flag variables, which were previously the only ways to achieve this behavior. The feature is currently in preview with .NET 11 preview 7 and requires setting LangVersion to preview. The author provides code examples comparing the new labeled syntax against goto-based and flag-based approaches, and shares a sample GitHub repository with tests. The feature could still change before the final C# 15 release, and the author expects it to be used sparingly, similar to goto statements, but valuable in the specific nested-loop scenarios it addresses.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.damirscorner.com/blog/posts/20260918-LabeledBreakAndContinueStatementsInCs15.html>

## Questions this post answers

### How do labeled break and continue statements work in C# 15?

C# 15 lets you place a label on an outer loop, then use 'continue outer;' or 'break outer;' inside a nested inner loop to affect that specific outer loop instead of the inner one. This replaces older patterns using goto statements or boolean flag variables to exit or continue nested loops, making the intent of the code clearer.

_Track how preview-stage C# features like this evolve before general availability on daily.dev._

### How do I enable preview language features like labeled break/continue in C# 15?

Set the LangVersion element to 'preview' inside a PropertyGroup in the project file. This is required because labeled continue and break statements, along with other C# 15 features, are still in preview and available starting with .NET 11 preview 7, and the syntax could change before the final release.

_Developers testing preview language features can follow changes like this on daily.dev before committing to them._

## Similar posts on daily.dev

- [Closed Hierarchies in C\# 15: Exhaustive Switches and Versioning — Daily DevOps & .NET](https://daily.dev/posts/closed-hierarchies-in-c-15-exhaustive-switches-and-versioning-daily-devops-net-vaomj42s2) · Daily DevOps & .NET · 24 upvotes · 2 comments
- [.NET Developer, Personal Blog](https://daily.dev/posts/net-developer-personal-blog-zxaphss3e) · Laszlo Deak · 13 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Labeled break and continue statements in C# 15","url":"https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc"},"datePublished":"2026-09-18T06:30:19.386Z","dateModified":"2026-09-18T06:41:25.760Z","description":"C# 15 introduces labeled break and continue statements, allowing developers to exit or continue an outer loop from within a nested loop by referencing a label...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/425073b57495acf9675afac1769c56ee?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/425073b57495acf9675afac1769c56ee?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Damir's Corner","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Damir's Corner","logo":"https://media.daily.dev/image/upload/s--9Wkl5ofQ--/f_auto,q_auto/v1780213496/logos/damirscorner?_a=BAMAMiWQ0","url":"https://daily.dev/sources/damirscorner"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Damir's Corner","item":"https://daily.dev/sources/damirscorner"},{"@type":"ListItem","position":3,"name":"Labeled break and continue statements in C# 15"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/labeled-break-and-continue-statements-in-c-15-26e8yrmrc#faq","mainEntity":[{"@type":"Question","name":"How do labeled break and continue statements work in C# 15?","acceptedAnswer":{"@type":"Answer","text":"C# 15 lets you place a label on an outer loop, then use 'continue outer;' or 'break outer;' inside a nested inner loop to affect that specific outer loop instead of the inner one. This replaces older patterns using goto statements or boolean flag variables to exit or continue nested loops, making the intent of the code clearer. Track how preview-stage C# features like this evolve before general availability on daily.dev."}},{"@type":"Question","name":"How do I enable preview language features like labeled break/continue in C# 15?","acceptedAnswer":{"@type":"Answer","text":"Set the LangVersion element to 'preview' inside a PropertyGroup in the project file. This is required because labeled continue and break statements, along with other C# 15 features, are still in preview and available starting with .NET 11 preview 7, and the syntax could change before the final release. Developers testing preview language features can follow changes like this on daily.dev before committing to them."}}]}
```

