{"id":4152,"date":"2023-03-02T20:27:10","date_gmt":"2023-03-03T01:27:10","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=4152"},"modified":"2023-03-02T20:27:10","modified_gmt":"2023-03-03T01:27:10","slug":"if-else-statements-6a","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/03\/02\/if-else-statements-6a\/","title":{"rendered":"If\/Else Statements &#8211; 6a"},"content":{"rendered":"<p>If\/else statements are used to run code on dependent on a condition being true or false. The condition in an if\/else statement is nested within the parentheses of the function. As the condition is passed, it will be decided whether it is true or false. If the condition is true, the code will execute one way, however, if the condition is false, the code will execute a different way. The if statement is used for a true condition, while else is used for the false condition. An example of an if\/else statement could be written as<br \/>\nif (x == 5) {<br \/>\nalert(\u201cThis number is equal to 5\u201d);<br \/>\n} else {<br \/>\nalert(\u201cThis number is not equal to 5\u201d);<br \/>\n} .<br \/>\nWith this example, the user would input a number to take the spot of x, if that number is 5 the condition will be true and the if statement will run. If it does not equal 5, the else statement will run. The use of isNaN is to identify whether or not the value used is an illegal number or not. If\/else statements can be more complex by using &amp;&amp; and II operators. The &amp;&amp; operator means that the condition is true is when both the first and second expression of the statement are both true and the II operator is true when either the first or the second expression evaluate to true in the condition.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If\/else statements are used to run code on dependent on a condition being true or false. The condition in an if\/else statement is nested within the parentheses of the function. As the condition is passed, it will be decided whether it is true or false. If the condition is true, the code will execute one [&hellip;]<\/p>\n","protected":false},"author":29379,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[663943],"tags":[],"class_list":{"0":"post-4152","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-instructor","7":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/4152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/users\/29379"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=4152"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/4152\/revisions"}],"predecessor-version":[{"id":4170,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/4152\/revisions\/4170"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=4152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=4152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=4152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}