{"id":338,"date":"2011-10-16T00:37:48","date_gmt":"2011-10-16T07:37:48","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/comp1400\/?p=338"},"modified":"2011-10-16T00:37:48","modified_gmt":"2011-10-16T07:37:48","slug":"loops","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/comp1400\/blog\/2011\/10\/loops\/","title":{"rendered":"Loops"},"content":{"rendered":"<p>To save people constantly looking up how to do loops in the lecture notes, here&#8217;s a simple example that prints the numbers 0 to 4 inclusive.<\/p>\n<p>As a for loop:<\/p>\n<p>for(int i=0; i&lt;5; i++) {<\/p>\n<p>System.out.println(i);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>As a while loop:<\/p>\n<p>int i=0;<\/p>\n<p>while(i&lt;5) {<\/p>\n<p>System.out.println(i);<\/p>\n<p>i++;<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To save people constantly looking up how to do loops in the lecture notes, here&#8217;s a simple example that prints the numbers 0 to 4 inclusive. As a for loop: for(int i=0; i&lt;5; i++) { System.out.println(i); } &nbsp; As a while loop: int i=0; while(i&lt;5) { System.out.println(i); i++; }<\/p>\n","protected":false},"author":400,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-338","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/users\/400"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":2,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/338\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}