{"id":37613,"date":"2016-09-10T08:54:48","date_gmt":"2016-09-10T13:54:48","guid":{"rendered":"http:\/\/shiannescamilla.wordpress.com\/?p=560"},"modified":"2016-09-10T08:54:48","modified_gmt":"2016-09-10T13:54:48","slug":"conditionals","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/conditionals\/","title":{"rendered":"Conditionals"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/shiannescamilla.wordpress.com\/2016\/09\/10\/conditionals\/\"><a href=\"https:\/\/shiannescamilla.wordpress.com\">Codebuster<\/a><\/a><\/em><br \/><\/p>\n<p>Another important thing are conditionals, conditionals\u00a0are a way to check for something, they\u00a0evaluate true or false and execute something.<\/p>\n<p>The &#8220;if&#8221; statement evaluates when a parameter given is true, if it is it will do what your specified.<\/p>\n<p>If can evaluate things like<\/p>\n<blockquote><p><span style=\"color:#003366;\">&gt; (less than)<\/span><br \/>\n<span style=\"color:#003366;\">&lt; (greater than)<\/span><br \/>\n<span style=\"color:#003366;\">&gt;= (less or equal than)<\/span><br \/>\n<span style=\"color:#003366;\">&lt;= (greater or equal than)<\/span><br \/>\n<span style=\"color:#003366;\">== (equals)<\/span><\/p><\/blockquote>\n<p>The &#8220;else&#8221; statement is a conditional that only executes if the expression &#8220;if&#8221; results false.<\/p>\n<p>But there is another conditional that lies between these two, called &#8220;elif&#8221;, this conditional is used when we want to evaluate if another condition is true, in the same block as the first if function, as such:<\/p>\n<blockquote><p>if \u00a05&gt;6:<br \/>\nprint (&#8220;Yes&#8221;)<\/p>\n<p>elif 7&gt;6:<br \/>\nprint(&#8220;Yup&#8221;)<\/p>\n<p>else 8&gt;6:<br \/>\nprint (&#8220;Ok&#8221;)<\/p><\/blockquote>\n<p>In that code, the result would be &#8220;Yup&#8221; because the code would run and stop after elif, since the condition was true.<\/p>\n<p>Here is another the example I worked on with <a href=\"https:\/\/a01228858.wordpress.com\/\">Max <\/a>(go check out his blog, it&#8217;s a cool one).<\/p>\n<p><img class=\"alignnone size-full wp-image-561\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/code-max.png?w=634\" alt=\"code-max\"   \/><\/p>\n<p>So here&#8217;s what would happen if you did pass<\/p>\n<p><img class=\"alignnone  wp-image-563\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/max-yes.png?w=666&#038;h=136\" alt=\"max-yes\" width=\"666\" height=\"136\" \/><\/p>\n<p>Oooor, if you didn&#8217;t make it&#8230;<\/p>\n<p><img class=\"alignnone  wp-image-564\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/max-sucks.png?w=668&#038;h=150\" alt=\"max-sucks\" width=\"668\" height=\"150\" \/><\/p>\n<p><img class=\"  wp-image-636 aligncenter\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/thats-all-folks1.gif?w=389&#038;h=285\" alt=\"thats-all-folks\" width=\"389\" height=\"285\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>P.d. Here is a great video that talks about conditionals<\/p>\n<blockquote><p><a href=\"https:\/\/www.youtube.com\/watch?v=mQrci1kAwh4\" rel=\"nofollow\">https:\/\/www.youtube.com\/watch?v=mQrci1kAwh4<\/a><\/p><\/blockquote>\n<p>&nbsp;<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/shiannescamilla.wordpress.com\/560\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/shiannescamilla.wordpress.com\/560\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=shiannescamilla.wordpress.com&#038;blog=115353408&%23038;post=560&%23038;subd=shiannescamilla&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Codebuster Another important thing are conditionals, conditionals\u00a0are a way to check for something, they\u00a0evaluate true or false and execute something. The &#8220;if&#8221; statement evaluates when a parameter given is true, if it is it will do what your specified. If can evaluate things like &gt; (less than) &lt; (greater than) &gt;= (less &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/conditionals\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Conditionals<\/span><\/a><\/p>\n","protected":false},"author":51,"featured_media":561,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[156,33],"class_list":["post-37613","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-programming-basics","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=37613"}],"version-history":[{"count":17,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37613\/revisions"}],"predecessor-version":[{"id":42995,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37613\/revisions\/42995"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=37613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=37613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=37613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}