{"id":132393,"date":"2023-05-16T15:27:22","date_gmt":"2023-05-16T09:57:22","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?page_id=132393"},"modified":"2024-04-12T14:16:51","modified_gmt":"2024-04-12T08:46:51","slug":"the-break-and-continue-statement","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/","title":{"rendered":"The Break and Continue Statement"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong>The Break and Continue Statement<\/strong><\/h4>\n\n\n\n<p>In C#, control flow refers to the order in which statements are executed in a program. It determines how the program progresses from one statement to another. Control flow can be modified using various control flow statements, such as the &#8220;break&#8221; and &#8220;continue&#8221; statements.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The &#8220;break&#8221; statement: The &#8220;break&#8221; statement is used to exit a loop or switch statement prematurely. When encountered within a loop (such as a &#8220;for&#8221; or &#8220;while&#8221; loop) or a switch statement, the &#8220;break&#8221; statement immediately terminates the loop or exits the switch statement, and the program continues with the next statement after the loop or switch.<\/li>\n<\/ol>\n\n\n\n<p>Here&#8217;s an example of using the &#8220;break&#8221; statement in a &#8220;for&#8221; loop:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">csharpCopy code<code>for (int i = 1; i &lt;= 10; i++)\n{\n    if (i == 5)\n    {\n        break;\n    }\n    Console.WriteLine(i);\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, the loop iterates from 1 to 10. When <code>i<\/code> becomes 5, the &#8220;if&#8221; condition is true, and the &#8220;break&#8221; statement is executed, causing the loop to terminate. As a result, only the numbers 1, 2, 3, and 4 will be printed.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>The &#8220;continue&#8221; statement: The &#8220;continue&#8221; statement is used to skip the rest of the statements within a loop and move on to the next iteration. When encountered, it jumps to the next iteration of the loop without executing the remaining statements in the current iteration. It is typically used to bypass certain iterations based on a specific condition.<\/li>\n<\/ol>\n\n\n\n<p>Here&#8217;s an example of using the &#8220;continue&#8221; statement in a &#8220;for&#8221; loop:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">csharpCopy code<code>for (int i = 1; i &lt;= 5; i++)\n{\n    if (i == 3)\n    {\n        continue;\n    }\n    Console.WriteLine(i);\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, the loop iterates from 1 to 5. When <code>i<\/code> becomes 3, the &#8220;if&#8221; condition is true, and the &#8220;continue&#8221; statement is executed. As a result, the WriteLine statement is skipped for that iteration, and the loop continues with the next iteration. The output will be 1, 2, 4, and 5.<\/p>\n\n\n\n<p>Both the &#8220;break&#8221; and &#8220;continue&#8221; statements provide ways to alter the normal control flow of a program. They can be powerful tools for controlling loops and making decisions based on specific conditions in C#.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apply for C Sharp Certification Now!!<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/Certified-C-sharp-Professional\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.vskills.in\/certification\/Certified-C-sharp-Professional<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-c-professional\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Back to Tutorial<\/strong><\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>The Break and Continue Statement In C#, control flow refers to the order in which statements are executed in a program. It determines how the program progresses from one statement to another. Control flow can be modified using various control flow statements, such as the &#8220;break&#8221; and &#8220;continue&#8221; statements. Here&#8217;s an example of using the&#8230;<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3351],"tags":[],"class_list":["post-132393","page","type-page","status-publish","hentry","category-c-sharp"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Break and Continue Statement - Tutorial<\/title>\n<meta name=\"description\" content=\"The break and continue statement\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Break and Continue Statement - Tutorial\" \/>\n<meta property=\"og:description\" content=\"The break and continue statement\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:46:51+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/\",\"name\":\"The Break and Continue Statement - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2023-05-16T09:57:22+00:00\",\"dateModified\":\"2024-04-12T08:46:51+00:00\",\"description\":\"The break and continue statement\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Break and Continue Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Break and Continue Statement - Tutorial","description":"The break and continue statement","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/","og_locale":"en_US","og_type":"article","og_title":"The Break and Continue Statement - Tutorial","og_description":"The break and continue statement","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:46:51+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/","name":"The Break and Continue Statement - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2023-05-16T09:57:22+00:00","dateModified":"2024-04-12T08:46:51+00:00","description":"The break and continue statement","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/the-break-and-continue-statement\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"The Break and Continue Statement"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/132393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=132393"}],"version-history":[{"count":2,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/132393\/revisions"}],"predecessor-version":[{"id":132395,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/132393\/revisions\/132395"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=132393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=132393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=132393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}