{"id":454,"date":"2010-01-01T05:28:34","date_gmt":"2010-01-01T12:28:34","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=2543"},"modified":"2010-01-01T05:28:34","modified_gmt":"2010-01-01T12:28:34","slug":"recursive-countdown","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=454","title":{"rendered":"Recursive Countdown"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nloop(20);\r\n\r\nfunction loop(i:int):void {\r\n\tif (i &lt; 0) return;\r\n\t  trace(i);\r\n\t  loop(i - 1);\r\n}\r\n\r\n\/* outputs:\r\n20\r\n19\r\n18\r\n17\r\n16\r\n15\r\n14\r\n13\r\n12\r\n11\r\n10\r\n9\r\n8\r\n7\r\n6\r\n5\r\n4\r\n3\r\n2\r\n1\r\n0\r\n*\/\r\n<\/pre>\n<p>This snippet uses a recursive function to count down from some number. Recursion is pretty useless in actionscript, it will eventually cause an error&#8230; If you were to try to countdown from a higher number it would choke pretty fast&#8230;<\/p>\n<p>Been writing <a href=\"http:\/\/www.haskell.org\/\">haskell<\/a> lately so I have recursion on the brain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>loop(20); function loop(i:int):void { if (i &lt; 0) return; trace(i); loop(i &#8211; 1); } \/* outputs: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 *\/ This snippet uses a recursive function to count down from some number. Recursion is pretty useless in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,94],"tags":[3,14,4],"class_list":["post-454","post","type-post","status-publish","format-standard","hentry","category-functions","category-misc","tag-actionscript","tag-as3","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=454"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/454\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}