{"id":3579,"date":"2023-02-28T19:00:59","date_gmt":"2023-03-01T00:00:59","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=3579"},"modified":"2023-03-02T21:30:35","modified_gmt":"2023-03-03T02:30:35","slug":"6b-loops","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/02\/28\/6b-loops\/","title":{"rendered":"6b Loops"},"content":{"rendered":"<p id=\"b697\" class=\"pw-post-body-paragraph ie if hh ig b ih ii ij ik il im in io ip iq ir is it iu iv iw ix iy iz ja jb gp bi\" data-selectable-paragraph=\"\">A loop is a programming structure that repeats a sequence of instructions until a specific condition is met. Loops allow you to repeat a process over and over without having to write the same instructions each time you want your program to perform a task, especially if the instruction is long and a pain to write over and over again.<\/p>\n<p id=\"60fd\" class=\"pw-post-body-paragraph ie if hh ig b ih ii ij ik il im in io ip iq ir is it iu iv iw ix iy iz ja jb gp bi\" data-selectable-paragraph=\"\">Two major types of loops are for loops and while loops. A For loop will run a preset number of times. A While loop will run a variable number of times.<\/p>\n<p data-selectable-paragraph=\"\">For loops are used for when you know how many times you want to run an algorithm before stopping. An example of a for loop is loading laundry into the washer. Say you have 4 steps. Step 1: Unload dirty laundry. Step 2: Sort out laundry load. Step 3: Put laundry in the washing machine. Step 4: Turn on machine.<\/p>\n<p data-selectable-paragraph=\"\">A while loop is similar, but a while loop runs a variable number of times. It would be similar steps, but\u00a0IF the laundry is not cleaned you run it again.<\/p>\n<p data-selectable-paragraph=\"\"><img decoding=\"async\" src=\"https:\/\/craftofcoding.files.wordpress.com\/2020\/04\/controlstr_loop1-1.jpg?w=620\" alt=\"Programming made easy \u2013 loops (i) \u2013 The Craft of Coding\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A loop is a programming structure that repeats a sequence of instructions until a specific condition is met. Loops allow you to repeat a process over and over without having to write the same instructions each time you want your program to perform a task, especially if the instruction is long and a pain to [&hellip;]<\/p>\n","protected":false},"author":24671,"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":[845006],"class_list":{"0":"post-3579","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-student-post","7":"tag-loops","8":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3579","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\/24671"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=3579"}],"version-history":[{"count":3,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3579\/revisions"}],"predecessor-version":[{"id":4275,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3579\/revisions\/4275"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=3579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=3579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=3579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}