{"id":167,"date":"2008-06-29T01:10:51","date_gmt":"2008-06-29T05:10:51","guid":{"rendered":"http:\/\/www.virtualroadside.com\/blog\/?p=167"},"modified":"2008-06-29T12:06:13","modified_gmt":"2008-06-29T16:06:13","slug":"the-answer-to-infinite-loops","status":"publish","type":"post","link":"https:\/\/www.virtualroadside.com\/blog\/index.php\/2008\/06\/29\/the-answer-to-infinite-loops\/","title":{"rendered":"The Answer to Infinite Loops"},"content":{"rendered":"<p>Programmers, we should make our infinite loops more exciting! A lot of times in C or other languages, you see infinite loops represented by things such as<\/p>\n<pre>while (1) { \/* do stuff here *\/ }<\/pre>\n<p>Or perhaps by<\/p>\n<pre>for (;;) { \/* do stuff here *\/ }<\/pre>\n<p>Thats so boring! Why not be more creative in your work? I propose that we use the following construct instead<\/p>\n<pre>while (42) { \/* do stuff here *\/ }<\/pre>\n<p>Now you might ask, why use while() instead of for() or do.. while()? In my opinion, its cleaner (the while part, not necessarily the number part). while() seems like the correct options, since (in my mind, at least) for() implies some set amount of iteration, whereas while() implies keep going until some condition is false. Of course, I do realize that they all do the same thing and each different one can do the same things as the others with some modification.<\/p>\n<p>Yes, that was a rather useless post, but I had to get it off of my chest \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Programmers, we should make our infinite loops more exciting! A lot of times in C or other languages, you see infinite loops represented by things such as while (1) { \/* do stuff here *\/ } Or perhaps by for (;;) { \/* do stuff here *\/ } Thats so boring! Why not be more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/167"}],"collection":[{"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=167"}],"version-history":[{"count":0,"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/167\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}