{"id":3394,"date":"2023-02-27T20:49:59","date_gmt":"2023-02-28T01:49:59","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=3394"},"modified":"2023-02-27T20:49:59","modified_gmt":"2023-02-28T01:49:59","slug":"3-parts-of-a-for-loop-6b","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/02\/27\/3-parts-of-a-for-loop-6b\/","title":{"rendered":"3 Parts of a For Loop (6b)"},"content":{"rendered":"<p>A for loop is used to check for specific conditions and to be able to repeat a block of code, only if the conditions are met. In a for loop there are three parts to it, which are the:<\/p>\n<ol>\n<li><strong>Initializer<\/strong><\/li>\n<\/ol>\n<p><strong>\u00a0 \u00a0 \u00a0 2. Condition<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 3. Iteration<\/strong><\/p>\n<p>So, the initializer is where you initialize a counter variable to be able to start with. And then, after the initializer is the condition. The condition is where we specify a condition that must be true in order for the iteration. The iteration is the increase or decrease the counter. Below I will show an example of what this would look like:<\/p>\n<p>for (var i = 0; i&lt;5; i++)<\/p>\n<p>{<\/p>\n<p>\u00a0 \u00a0 \u00a0Console.log(i);<\/p>\n<p>}<\/p>\n<p>This is an example of a for loop and where each step is used in the coding process. var i = 0 is the initializer, whereas\u00a0 i &lt; 5 is a condition and it is going to check whether or not i is less than 5 or if it is not. The last and third portion is the i++ which is the iteration. I think that the for loop is the loop that I am able to comprehend the best from each kind of loop, and I have definitely been practicing the most with this specific one.\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3401\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/Screen-Shot-2023-02-27-at-8.48.30-PM.png\" alt=\"\" width=\"772\" height=\"542\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/Screen-Shot-2023-02-27-at-8.48.30-PM.png 772w, https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/Screen-Shot-2023-02-27-at-8.48.30-PM-300x211.png 300w, https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/02\/Screen-Shot-2023-02-27-at-8.48.30-PM-768x539.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A for loop is used to check for specific conditions and to be able to repeat a block of code, only if the conditions are met. In a for loop there are three parts to it, which are the: Initializer \u00a0 \u00a0 \u00a0 2. Condition \u00a0 \u00a0 \u00a0 3. Iteration So, the initializer is where [&hellip;]<\/p>\n","protected":false},"author":29246,"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":[10531],"tags":[845102,669510],"class_list":{"0":"post-3394","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-student-post","7":"tag-for-loop","8":"tag-system","9":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/users\/29246"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=3394"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3394\/revisions"}],"predecessor-version":[{"id":3402,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3394\/revisions\/3402"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=3394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=3394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=3394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}