{"id":3814,"date":"2023-03-02T00:45:20","date_gmt":"2023-03-02T05:45:20","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=3814"},"modified":"2023-03-02T00:54:22","modified_gmt":"2023-03-02T05:54:22","slug":"three-parts-of-a-for-loop-6b","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/03\/02\/three-parts-of-a-for-loop-6b\/","title":{"rendered":"Three parts of a for loop. &#8211; 6B"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3816\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/FOR-LOOP-300x125.png\" alt=\"\" width=\"300\" height=\"125\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/FOR-LOOP-300x125.png 300w, https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/FOR-LOOP.png 347w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3815\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/loop-300x141.png\" alt=\"\" width=\"300\" height=\"141\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/loop-300x141.png 300w, https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/files\/2023\/03\/loop.png 328w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>JavaScript includes for loop like Java or C#. Use for loop to execute code repeatedly.<br \/>\nThe for loop requires following three parts.<\/p>\n<p>Initializer: Initialize a counter variable to start with<br \/>\nCondition: specify a condition that must evaluate to true for next iteration<br \/>\nIteration: increase or decrease counter<\/p>\n<p>Example<\/p>\n<ol>\n<li>for(int i = 0; i&lt;= 5; i++)\u00a0<\/li>\n<\/ol>\n<p>\u00a0Three parts are separated via ; (semi-colon).<\/p>\n<p>PART 1 :- int i = 0 This part of the for loop is known as initialization. Here we initialize the loop variable which will iterate through the loop.<\/p>\n<p>\nPART 2 :- i &lt;=5 This part is known as condition or you can say comparison, as it suits but condition is the word which suits here better. This part will set certain condition for loop variable regarding how much time it should iterate.<\/p>\n<p>\nPART 3 :- i++ \u00a0This is increment \/ decrement part. Here the value of loop variable is either incremented or decremented. The value change is done after execution of certain statements in loop. The value keeps changing until the condition is fulfilled.<\/p>\n<p><a href=\"https:\/\/www.tutorialsteacher.com\/javascript\/javascript-for-loop\">https:\/\/www.tutorialsteacher.com\/javascript\/javascript-for-loop<\/a><\/p>\n<p><strong><a href=\"https:\/\/www.quora.com\/What-are-the-3-parts-of-a-for-loop\">https:\/\/www.quora.com\/What-are-the-3-parts-of-a-for-loop<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; JavaScript includes for loop like Java or C#. Use for loop to execute code repeatedly. The for loop requires following three parts. Initializer: Initialize a counter variable to start with Condition: specify a condition that must evaluate to true for next iteration Iteration: increase or decrease counter Example for(int i = 0; i&lt;= 5; [&hellip;]<\/p>\n","protected":false},"author":29429,"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":[],"class_list":{"0":"post-3814","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-student-post","7":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3814","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\/29429"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=3814"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3814\/revisions"}],"predecessor-version":[{"id":3817,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3814\/revisions\/3817"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=3814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=3814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=3814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}