{"id":16539,"date":"2024-12-19T01:31:53","date_gmt":"2024-12-18T22:01:53","guid":{"rendered":"https:\/\/www.itpiran.net\/blog\/?p=16539"},"modified":"2024-12-19T01:31:53","modified_gmt":"2024-12-18T22:01:53","slug":"how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2","status":"publish","type":"post","link":"https:\/\/www.itpiran.net\/blog\/en\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/","title":{"rendered":"How to use Continue, Break, and Pass statements when working with loops in Python"},"content":{"rendered":"<h2 id=\"%d9%85%d9%82%d8%af%d9%85%d9%87\">Introduction<\/h2>\n<p>Using for loops and while loops in Python allows you to repeat tasks automatically and efficiently. These loops are fundamental constructs in Python that allow you to iterate over sequences such as lists, tuples, and strings, or to execute a block of code repeatedly based on a condition.<\/p>\n<p>However, there are scenarios where you need more control over the flow of your loops. For example, you might encounter a situation where you need to exit a loop prematurely, skip the current iteration, or simply have a placeholder for future code. Python provides three powerful statements to handle these cases: break, continue, and pass.<\/p>\n<ul>\n<li>The break statement allows you to exit a loop completely if a specific condition is met, effectively stopping the loop&#039;s execution.<\/li>\n<li>The break statement allows you to exit a loop completely if a specific condition is met, effectively stopping the loop&#039;s execution.<\/li>\n<li>The pass statement is a null operator. It is used as a placeholder in loops, functions, classes, or conditionals where code is syntactically required but you have nothing to execute.<\/li>\n<\/ul>\n<p>Understanding and using these statements can significantly enhance your ability to manage loop control flow, making your code more efficient and easier to read. In the following sections, we will look at practical examples of how to use the break, continue, and pass statements in Python loops.<\/p>\n<h5 id=\"%d9%be%db%8c%d8%b4-%d9%86%db%8c%d8%a7%d8%b2%d9%87%d8%a7\">Prerequisites<\/h5>\n<p>You must have Python 3 installed and a development environment on your computer or server. Let&#039;s say you haven&#039;t set up a development environment. In that case, you can refer to the installation and setup guide to set up a local Python development environment on your server appropriate for your operating system (Ubuntu, CentOS, Debian, etc.).<\/p>\n<h2 id=\"break-statement\">Break Statement<\/h2>\n<p>In Python, the break statement allows you to exit a loop when an external condition is triggered. You place the break statement in the block of code below your loop statement, usually after an if conditional statement.<\/p>\n<p>Let&#039;s look at an example that uses the break statement in a for loop:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>number = 0\r\nfor number in range(10):\r\nif number == 5:\r\nbreak # break here\r\nprint('Number is ' + str(number))\r\nprint('Out of loop')<\/code><\/pre>\n<\/div>\n<p>The variable number in this small program is initialized to 0. Then, if the variable number is less than 10, it creates a for loop.<\/p>\n<p>In a for loop, an if statement provides a condition that the loop will break if the variable number is equal to the integer 5. For more information on using the for loop, you can refer to this tutorial on using the for() loop in Python.<\/p>\n<p>Inside the loop there is also a print() statement that is executed with each iteration of the for loop until the loop breaks, because it is after the break statement.<\/p>\n<p>Let&#039;s put a final print() statement outside the for loop so we know when we&#039;re out of the loop.<\/p>\n<p>When you run this code, you will get the following output:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\nNumber is 0\r\nNumber is 1\r\nNumber is 2\r\nNumber is 3\r\nNumber is 4\r\nOut of loop<\/code><\/pre>\n<\/div>\n<p>This shows that the loop breaks when the integer evaluates to 5, as the program is told to do with the break statement.<\/p>\n<p>The break statement causes a program to exit a loop.<\/p>\n<h2 id=\"continue-statement\">Continue Statement<\/h2>\n<p>The continue statement allows you to skip the part of a loop where an outer condition is triggered, but continue the loop. The current iteration of the loop is interrupted, but the program returns to the top of the loop.<\/p>\n<p>The continue statement will be placed in the code block below the loop statement, usually after an if conditional statement.<\/p>\n<p>Using the same for loop program in the break statement section above, we will use the continue statement instead of the break statement:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>number = 0\r\nfor number in range(10):\r\nif number == 5:\r\ncontinue # continue here\r\nprint('Number is ' + str(number))\r\nprint('Out of loop')<\/code><\/pre>\n<\/div>\n<p>The difference in using the continue statement instead of the break statement is that our code continues despite the interruption when the variable number evaluates to 5. Let&#039;s examine our output:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\nNumber is 0\r\nNumber is 1\r\nNumber is 2\r\nNumber is 3\r\nNumber is 4\r\nNumber is 6\r\nNumber is 7\r\nNumber is 8\r\nNumber is 9\r\nOut of loop<\/code><\/pre>\n<\/div>\n<p>Here, the number 5 never occurs in the output, but the loop continues after that point to print lines for the numbers 6-10 before exiting the loop.<\/p>\n<p>You can use the continue statement to avoid deeply nested conditional code or to optimize a loop by eliminating items you want to skip.<\/p>\n<p>The continue statement causes a program to skip certain elements that appear in a loop but then continue through the rest of the loop.<\/p>\n<h2 id=\"pass-statement\">Pass Statement<\/h2>\n<p>When an external condition is triggered, the pass statement allows you to handle the condition without affecting the loop in any way. All code continues to read unless a failure or other statement occurs.<\/p>\n<p>Like other statements, the pass statement will be placed in the code block below the loop statement, usually after an if conditional statement.<\/p>\n<p>Using the same code block above, let&#039;s replace the break or continue statement with a pass statement:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>number = 0\r\nfor number in range(10):\r\nif number == 5:\r\npass # pass here\r\nprint('Number is ' + str(number))\r\nprint('Out of loop')<\/code><\/pre>\n<\/div>\n<p>After the if conditional statement, the pass statement tells the program to continue executing the loop and ignore that the variable number evaluates to 5 during one of its iterations.<\/p>\n<p>You run the program and get the following output:<\/p>\n<div class=\"hcb_wrap\" data-no-translation=\"\" data-no-auto-translation=\"\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Output\r\nNumber is 0\r\nNumber is 1\r\nNumber is 2\r\nNumber is 3\r\nNumber is 4\r\nNumber is 5\r\nNumber is 6\r\nNumber is 7\r\nNumber is 8\r\nNumber is 9\r\nOut of loop<\/code><\/pre>\n<\/div>\n<p>By using the pass statement in this program, you will notice that the program executes exactly as it would if the conditional statement were not present in the program. The pass statement tells the program to ignore the condition and continue executing the program as usual.<\/p>\n<p>The pass statement can create minimal classes, or act as a placeholder when working on new code and thinking at an algorithmic level before hammering out the details.<\/p>\n<h2 id=\"%d9%86%d8%aa%db%8c%d8%ac%d9%87\">Result<\/h2>\n<p>The break, continue, and pass statements in Python allow you to use for and while loops more effectively in your code.<\/p>","protected":false},"excerpt":{"rendered":"Introduction Using for loops and while loops in Python allows you to automate tasks and\u2026","protected":false},"author":1,"featured_media":16542,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"Break \u0648 Continue \u0648 Pass \u062f\u0631 Python","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"","_yoast_wpseo_canonical":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_opengraph-image":"","_yoast_wpseo_twitter-description":"","_yoast_wpseo_twitter-image":"","_yoast_wpseo_focuskeywords":"[]","_yoast_wpseo_primary_category":"193","footnotes":""},"categories":[193,363],"tags":[376],"class_list":{"0":"post-16539","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-tutorials","8":"category-programming","9":"tag-python"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python - \u0628\u0644\u0627\u06af ITPiran<\/title>\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.itpiran.net\/blog\/en\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python - \u0628\u0644\u0627\u06af ITPiran\" \/>\n<meta property=\"og:description\" content=\"\u0645\u0642\u062f\u0645\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062d\u0644\u0642\u0647\u200c\u0647\u0627\u06cc for \u0648 \u062d\u0644\u0642\u0647\u200c\u0647\u0627\u06cc while \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0647 \u0634\u0645\u0627 \u0627\u0645\u06a9\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648\u0638\u0627\u06cc\u0641 \u0631\u0627 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0648&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.itpiran.net\/blog\/en\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0628\u0644\u0627\u06af ITPiran\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-18T22:01:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1793\" \/>\n\t<meta property=\"og:image:height\" content=\"1110\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/person\\\/04ed27b919baca468a2273f8e4318f81\"},\"headline\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python\",\"datePublished\":\"2024-12-18T22:01:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/\"},\"wordCount\":68,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/12\\\/19013025\\\/Python-Break-Pass-Continue.jpg\",\"keywords\":[\"Python\"],\"articleSection\":[\"\u0622\u0645\u0648\u0632\u0634\u06cc\",\"\u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/\",\"name\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python - \u0628\u0644\u0627\u06af ITPiran\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/12\\\/19013025\\\/Python-Break-Pass-Continue.jpg\",\"datePublished\":\"2024-12-18T22:01:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/12\\\/19013025\\\/Python-Break-Pass-Continue.jpg\",\"contentUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2024\\\/12\\\/19013025\\\/Python-Break-Pass-Continue.jpg\",\"width\":1793,\"height\":1110},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/tutorials\\\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u0622\u0645\u0648\u0632\u0634\u06cc\",\"item\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/category\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\",\"name\":\"\u0628\u0644\u0627\u06af ITPiran\",\"description\":\"\u0627\u062e\u0628\u0627\u0631 \u0648 \u0645\u0642\u0627\u0644\u0627\u062a \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#organization\",\"name\":\"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\",\"alternateName\":\"ITPIran Blog\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/cdn.itpiran.net\\\/2023\\\/12\\\/27150508\\\/cropped-ITPIRAN-BLOG-LOGO-2.png\",\"contentUrl\":\"https:\\\/\\\/cdn.itpiran.net\\\/2023\\\/12\\\/27150508\\\/cropped-ITPIRAN-BLOG-LOGO-2.png\",\"width\":512,\"height\":512,\"caption\":\"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646\"},\"image\":{\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/#\\\/schema\\\/person\\\/04ed27b919baca468a2273f8e4318f81\",\"name\":\"admin\",\"url\":\"https:\\\/\\\/www.itpiran.net\\\/blog\\\/en\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Continue, Break, and Pass statements when working with loops in Python - ITPiran Blog","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.itpiran.net\/blog\/en\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/","og_locale":"en_US","og_type":"article","og_title":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python - \u0628\u0644\u0627\u06af ITPiran","og_description":"\u0645\u0642\u062f\u0645\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062d\u0644\u0642\u0647\u200c\u0647\u0627\u06cc for \u0648 \u062d\u0644\u0642\u0647\u200c\u0647\u0627\u06cc while \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0647 \u0634\u0645\u0627 \u0627\u0645\u06a9\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648\u0638\u0627\u06cc\u0641 \u0631\u0627 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0648&hellip;","og_url":"https:\/\/www.itpiran.net\/blog\/en\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/","og_site_name":"\u0628\u0644\u0627\u06af ITPiran","article_published_time":"2024-12-18T22:01:53+00:00","og_image":[{"width":1793,"height":1110,"url":"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#article","isPartOf":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/"},"author":{"name":"admin","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/person\/04ed27b919baca468a2273f8e4318f81"},"headline":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python","datePublished":"2024-12-18T22:01:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/"},"wordCount":68,"commentCount":0,"publisher":{"@id":"https:\/\/www.itpiran.net\/blog\/#organization"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg","keywords":["Python"],"articleSection":["\u0622\u0645\u0648\u0632\u0634\u06cc","\u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/","url":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/","name":"How to use Continue, Break, and Pass statements when working with loops in Python - ITPiran Blog","isPartOf":{"@id":"https:\/\/www.itpiran.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#primaryimage"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg","datePublished":"2024-12-18T22:01:53+00:00","breadcrumb":{"@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#primaryimage","url":"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg","contentUrl":"https:\/\/cdn.itpiran.net\/2024\/12\/19013025\/Python-Break-Pass-Continue.jpg","width":1793,"height":1110},{"@type":"BreadcrumbList","@id":"https:\/\/www.itpiran.net\/blog\/tutorials\/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.itpiran.net\/blog\/"},{"@type":"ListItem","position":2,"name":"\u0622\u0645\u0648\u0632\u0634\u06cc","item":"https:\/\/www.itpiran.net\/blog\/category\/tutorials\/"},{"@type":"ListItem","position":3,"name":"\u0646\u062d\u0648\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0639\u0628\u0627\u0631\u062a Continue\u060c Break \u0648 Pass \u0647\u0646\u06af\u0627\u0645 \u06a9\u0627\u0631 \u0628\u0627 \u062d\u0644\u0642\u0647 \u0647\u0627 \u062f\u0631 Python"}]},{"@type":"WebSite","@id":"https:\/\/www.itpiran.net\/blog\/#website","url":"https:\/\/www.itpiran.net\/blog\/","name":"ITPiran Blog","description":"Iranian Sustainable Trade News and Articles","publisher":{"@id":"https:\/\/www.itpiran.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.itpiran.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.itpiran.net\/blog\/#organization","name":"Sustainable Iranian Business Blog","alternateName":"ITPIran Blog","url":"https:\/\/www.itpiran.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.itpiran.net\/2023\/12\/27150508\/cropped-ITPIRAN-BLOG-LOGO-2.png","contentUrl":"https:\/\/cdn.itpiran.net\/2023\/12\/27150508\/cropped-ITPIRAN-BLOG-LOGO-2.png","width":512,"height":512,"caption":"\u0628\u0644\u0627\u06af \u062a\u062c\u0627\u0631\u062a \u067e\u0627\u06cc\u062f\u0627\u0631 \u0627\u06cc\u0631\u0627\u0646\u06cc\u0627\u0646"},"image":{"@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.itpiran.net\/blog\/#\/schema\/person\/04ed27b919baca468a2273f8e4318f81","name":"admin","url":"https:\/\/www.itpiran.net\/blog\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/posts\/16539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/comments?post=16539"}],"version-history":[{"count":1,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/posts\/16539\/revisions"}],"predecessor-version":[{"id":16543,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/posts\/16539\/revisions\/16543"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/media\/16542"}],"wp:attachment":[{"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/media?parent=16539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/categories?post=16539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itpiran.net\/blog\/en\/wp-json\/wp\/v2\/tags?post=16539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}