Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":28159,"date":"2015-11-25T19:55:32","date_gmt":"2015-11-26T01:55:32","guid":{"rendered":"http:\/\/juansalvadorfernandez.wordpress.com\/?p=175"},"modified":"2015-11-25T19:55:32","modified_gmt":"2015-11-26T01:55:32","slug":"when-to-use-which-repetition","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/when-to-use-which-repetition\/","title":{"rendered":"When to use which repetition"},"content":{"rendered":"

So far we have seen both \u201cwhile\u201d and \u201cfor\u201d loops, but now we will learn to judge in which situation we need to use either of them.<\/p>\n

The \u201cwhile\u201d loop will repeat itself as long as the condition that accompanies it remains true, this means that a \u201cwhile\u201d loop will tend to repeat itself to infinity unless we do something to make the condition that controls it become false.<\/p>\n

On the contrary, the \u201cfor\u201d loop will tend to run once for each value given, and since we tend to have a finite amount of values to work with the loop tends to be finite as well.<\/p>\n

Knowing this difference will save you a lot of work if you learn to differentiate the problem you need to solve.<\/p>\n

A very easy way to identify which form of loop to use is reading the contents of the rest of the programs. Most of the time, if we are using lists, ranges, tuples or dictionaries we will be required to use a \u201cfor\u201d loop, since the problem at hand is to go through all of the contents of either of the previously stated types and perform an action according to its contents and their value.<\/p>\n

As for \u201cwhile\u201d loops, they come in handy when the amount of cycles we will have to perform in order to solve the problem is unknown to us.<\/p>\n

You can even use both at the same time, as I implied earlier, it all depends on your needs.<\/p>\n

One example of this is the case of having a list with vive values inside of it, all integers. We need to calculate the factorial of each number. To go over all of the length of the list and check all of the values we need to use a \u201cfor\u201d loop, but to actually calculate the factorial we would need a \u201cwhile\u201d using the value found by the \u201cfor\u201d to do the math, then the \u201cfor\u201d would move on to the next position and so on.<\/p>\n

And just like with the \u201cif, elif, else\u201d business, be warry of indentation.<\/p>\n

\"\"<\/a> \"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

So far we have seen both “while” and “for” loops, but now we will learn to judge in which situation we need to use either of them. The “while” loop will repeat itself as long as the condition that accompanies it remains true, this means that a “while” loop will tend to repeat itself to … Continue reading When to use which repetition<\/span><\/a>\"\"<\/p>\n","protected":false},"author":211,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[903,904,39],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28159"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/211"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=28159"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28159\/revisions"}],"predecessor-version":[{"id":28160,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28159\/revisions\/28160"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=28159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=28159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=28159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}