Labels in Dart Last Updated : 26 Mar, 2025 Comments Improve Suggest changes 12 Likes Like Report Most people, who have programmed in C programming language, are aware of goto and label statements which are used to jump from one point to another unlike Java, Dart also doesn't have any goto statements but indeed it has labels that can be used with continue and break statements and help them to take a bigger leap in the code.Dart does allow line breaks between labels and loop control statements.Using a label with the break statement Example : Dart void main() { // Defining the label Geek1:for(int i=0; i<3; i++) { if(i < 2) { print("You are inside the loop Geek"); // breaking with label break Geek1; } print("You are still inside the loop"); } } Output: You are inside the loop GeekThe loop does not return because a break with a label exits the entire labeled loop rather than just the inner loop.Using a label with the continue statement Example : Dart void main() { // Defining the label Geek1:for(int i=0; i<3; i++) { if(i < 2) { print("You are inside the loop Geek"); // Continue with label continue Geek1; } print("You are still inside the loop"); } } Output: You are inside the loop GeekYou are inside the loop GeekYou are still inside the loopThe above code results in printing the statement twice because of the condition; it didn't break out of the loop and thus printed it twice.Dart does not have a goto statement like C, but it does support labels for use with break and continue. These labels enable control to be transferred to specific loops, making it easier to exit nested loops or skip iterations efficiently.Using break with a label: When you use break with a label, it exits the entire labeled loop, not just the innermost loop.Using continue with a label: When you use continue with a label, it skips the current iteration of the labeled loop and proceeds to the next iteration.By understanding how to use labels, you can effectively manage complex loops without unnecessary nesting or redundant conditions. Create Quiz Comment A aditya_taparia Follow 12 Improve A aditya_taparia Follow 12 Improve Article Tags : Dart Dart-basics Explore BasicsIntroduction to Dart Programming Language 4 min read Dart SDK Installation 4 min read Dart - Comments 2 min read Dart - Variables 5 min read Operators in Dart 11 min read Dart - Standard Input Output 3 min read Data TypesDart - Data Types 8 min read Basics of Numbers in Dart 6 min read Strings in Dart 6 min read Dart - Sets 6 min read Dart Programming - Map 7 min read Queues in Dart 3 min read Data Enumeration in Dart 3 min read Control FlowDart Programming - If Else Statement (if , if..else, Nested if, if-else-if) 4 min read Switch Case in Dart 2 min read Dart - Loops 4 min read Dart - Loop Control Statements (Break and Continue) 4 min read Labels in Dart 2 min read Key FunctionsDart - Functions 4 min read Different Types of Functions in Dart 4 min read Dart - Anonymous Functions 2 min read Dart - main() Function 2 min read Dart - Common Collection Methods 2 min read How to Exit a Dart Application Unconditionally? 2 min read Dart - Getters and Setters 3 min read Object-Oriented ProgrammingDart - Classes And Objects 4 min read Constructors in Dart 5 min read Super Constructor in Dart 2 min read Dart - this keyword 2 min read Dart - Static Keyword 3 min read Dart - Super and This keyword 4 min read Dart - Concept of Inheritance 5 min read Instance and class methods in Dart 3 min read Method Overriding in Dart 3 min read Getter and Setter Methods in Dart 2 min read Abstract Classes in Dart 4 min read Dart - Builder Class 4 min read Concept of Callable Classes in Dart 4 min read Interface in Dart 3 min read Dart - extends Vs with Vs implements 4 min read Dart UtilitiesDart - Date and Time 3 min read Using await async in Dart 4 min read Dart - Type System 3 min read Generators in Dart 2 min read Dart ProgramsHow to Combine Lists in Dart? 3 min read Dart - Finding Minimum and Maximum Value in a List 5 min read Dart - Splitting of String 1 min read How to Append or Concatenate Strings in Dart? 2 min read How to Find the Length of a String in Dart? 1 min read Dart - Sort a List 2 min read Dart - String toUpperCase() Function with Examples 1 min read Dart - Convert All Characters of a String in Lowercase 1 min read How to Replace a Substring of a String in Dart? 2 min read How to Check String is Empty or Not in Dart (Null Safety)? 1 min read Advance ConceptsException Handling in Dart 3 min read Assert Statements in Dart 3 min read Fallthrough Condition in Dart 3 min read Concept of Isolates in Dart 2 min read Typedef in Dart 3 min read Dart - URIs 2 min read Dart - Collections 7 min read Dart - Basics of Packages 2 min read Dart - String codeUnits Property 1 min read HTML Document Object Model and Dart Programming 3 min read Like