{"id":707,"date":"2012-07-15T13:36:25","date_gmt":"2012-07-15T12:36:25","guid":{"rendered":"http:\/\/blogs.kent.ac.uk\/mik\/?p=707"},"modified":"2020-05-15T15:46:54","modified_gmt":"2020-05-15T15:46:54","slug":"joc-32","status":"publish","type":"post","link":"https:\/\/blogs.kcl.ac.uk\/proged\/2012\/07\/15\/joc-32\/","title":{"rendered":"JoC #32: Pretty pictures with while loops"},"content":{"rendered":"<p><em>\u00a0 \u00a0 \u00a0 90% Rule of Project Schedules: &#8220;The first 90% of the task takes 90% <\/em><br \/>\n<em>\u00a0 \u00a0 \u00a0 of the\u00a0time, and the last 10% takes the other 90%.&#8221;<\/em><br \/>\n<em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u2014 (source unknown)\u00a0<\/em><\/p>\n<p>One more time, discussions of loops.<\/p>\n<p>Loops are such an important concept, and there are so many variations, that it is really important to get practice with them and get them properly into your head. To this end, we&#8217;re looking one more time at loops here before moving on to some new concepts in the next episode.<\/p>\n<p>Today, we&#8217;re using a really important, fundamental loop pattern: A while loop with a simple loop counter. It looks like this:<\/p>\n<pre>    <strong>int i = 0;<\/strong>\n    <strong>while (i &lt;<\/strong> <span style=\"color: #888888\"><em>NUMBER<\/em><\/span><strong>)<\/strong>\n    <strong>{<\/strong>\n\u00a0 \u00a0     <em><span style=\"color: #888888\">doSomething();<\/span><\/em>\n\u00a0 \u00a0     <strong>i = i + 1;<\/strong>\n    <strong>}<\/strong><\/pre>\n<p>Watch the video, and try to memorize this pattern. It will come in handy later!<\/p>\n<p><iframe loading=\"lazy\" title=\"The Joy of Code #32: Pretty pictures with while loops\" width=\"584\" height=\"329\" src=\"https:\/\/www.youtube.com\/embed\/e95EiA4WBfU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p style=\"text-align: right\"><a href=\"http:\/\/www.greenfoot.org\/static\/joc\/mov\/JOC-32.mov\">Download video<\/a><\/p>\n<p><strong>Concepts discussed<\/strong>:\u00a0<em>loops, while loop<\/em><\/p>\n<p>Download (scenario as of beginning of this episode):\u00a0<a href=\"http:\/\/www.greenfoot.org\/static\/joc\/material\/breakout-v6.zip\">breakout-v6.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 \u00a0 90% Rule of Project Schedules: &#8220;The first 90% of the task takes 90% \u00a0 \u00a0 \u00a0 of the\u00a0time, and the last 10% takes the other 90%.&#8221; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u2014 (source unknown)\u00a0 One more &hellip; <a href=\"https:\/\/blogs.kcl.ac.uk\/proged\/2012\/07\/15\/joc-32\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":179,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,6],"tags":[69,89,119],"class_list":["post-707","post","type-post","status-publish","format-standard","hentry","category-greenfoot-software-tools","category-joy-of-code","tag-loop","tag-random-number","tag-while-loop"],"_links":{"self":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/users\/179"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/comments?post=707"}],"version-history":[{"count":1,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/707\/revisions"}],"predecessor-version":[{"id":1078,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/707\/revisions\/1078"}],"wp:attachment":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/media?parent=707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/categories?post=707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/tags?post=707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}