
{"id":223,"date":"2018-09-20T15:17:20","date_gmt":"2018-09-20T15:17:20","guid":{"rendered":"http:\/\/blogs.plymouth.ac.uk\/embedded-systems\/?page_id=223"},"modified":"2018-09-20T16:11:14","modified_gmt":"2018-09-20T16:11:14","slug":"while-loop-glossary-entry","status":"publish","type":"page","link":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/glossary-2\/while-loop-glossary-entry\/","title":{"rendered":"While-Loop (Glossary Entry)"},"content":{"rendered":"<p>This is the syntax of a C programming technique used to <i>repeat a block of code while some condition is met<\/i>.<\/p>\n<pre class=\"theme:xcode lang:c++ decode:true \">while (&lt;condition to enter the loop&gt;) {\r\n\/\/ Loop body\r\n}<\/pre>\n<p>Graphically, we can represented this as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-224\" src=\"http:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart-258x300.png\" alt=\"\" width=\"258\" height=\"300\" srcset=\"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart-258x300.png 258w, https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart-560x652.png 560w, https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart-260x303.png 260w, https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart-160x186.png 160w, https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-content\/uploads\/sites\/94\/2018\/09\/WhileLoop-Flowchart.png 660w\" sizes=\"auto, (max-width: 258px) 100vw, 258px\" \/><\/p>\n<p><b>Important<span class=\"Apple-converted-space\">\u00a0 <\/span>Notes<\/b>:<\/p>\n<ul>\n<li>the condition to enter the loop is evaluated first &#8211; if not met, the loop body is never executed (contrast to do-while loops)<\/li>\n<li>that the condition to enter the loop body is reevaluated each time around the loop.<\/li>\n<\/ul>\n<p><b>break and continue<\/b><\/p>\n<p>As with the <b>for-loop<\/b>, it is possible to jump to the end of a loop block with the <b>continue<\/b> statement and break out of the loop early with the <b>break<\/b> statement.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the syntax of a C programming technique used to repeat a block of code while some condition is met. while (&lt;condition to enter the loop&gt;) { \/\/ Loop body } Graphically, we can represented this as follows: Important\u00a0 Notes: the condition to enter the loop is evaluated first &#8211; if not met, the&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/glossary-2\/while-loop-glossary-entry\/\">Continue reading <span class=\"screen-reader-text\">While-Loop (Glossary Entry)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":153,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-223","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/pages\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":1,"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/pages\/223\/revisions"}],"predecessor-version":[{"id":225,"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/pages\/223\/revisions\/225"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/pages\/153"}],"wp:attachment":[{"href":"https:\/\/blogs.plymouth.ac.uk\/embedded-systems\/wp-json\/wp\/v2\/media?parent=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}