{"id":2574,"date":"2022-06-13T19:41:58","date_gmt":"2022-06-13T23:41:58","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/?p=2574"},"modified":"2022-06-13T19:42:24","modified_gmt":"2022-06-13T23:42:24","slug":"what-are-the-three-parts-of-a-for-loop","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/2022\/06\/13\/what-are-the-three-parts-of-a-for-loop\/","title":{"rendered":"What is a for loop?"},"content":{"rendered":"<p>Loops are useful when you repeatedly want to run the same code, but with a different value each time it runs. There are numerous types of loops, however, &#8220;<em>for loops<\/em>&#8221; are used to loop through a block of code a number of times.<\/p>\n<p>The for loop has the following syntax, or format:\u00a0<\/p>\n<p><span class=\"jskeywordcolor\" style=\"color: #3366ff\">for<\/span>\u00a0(statement 1;\u00a0statement 2;\u00a0statement 3) {<\/p>\n<p>\u00a0 \u00a0 \u00a0<span style=\"color: #339966\"> \/\/ code block to be executed<\/span><\/p>\n<p>}<\/p>\n<p><strong>Statement 1<\/strong> is executed one time before the execution of the code block.<\/p>\n<p><strong>Statement 2<\/strong>\u00a0defines the condition for executing the code block.<\/p>\n<p><strong>Statement 3<\/strong> is executed every time after the code block has been executed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2575 aligncenter\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop-300x185.jpg\" alt=\"\" width=\"454\" height=\"280\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop-300x185.jpg 300w, https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop-1024x630.jpg 1024w, https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop-768x473.jpg 768w, https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop-1536x945.jpg 1536w, https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/For-Loop.jpg 1794w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Loops are useful when you repeatedly want to run the same code, but with a different value each time it runs. There are numerous types of loops, however, &#8220;for loops&#8221; are used to loop through a block of code a number of times. The for loop has the following syntax, or format:\u00a0 for\u00a0(statement 1;\u00a0statement 2;\u00a0statement [&hellip;]<\/p>\n","protected":false},"author":28307,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[663943],"tags":[],"class_list":["post-2574","post","type-post","status-publish","format-standard","category-instructor","entry"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/users\/28307"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/comments?post=2574"}],"version-history":[{"count":2,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2574\/revisions"}],"predecessor-version":[{"id":2577,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2574\/revisions\/2577"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/media?parent=2574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/categories?post=2574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/tags?post=2574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}