{"id":3249,"date":"2023-02-24T18:57:41","date_gmt":"2023-02-24T23:57:41","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/?p=3249"},"modified":"2023-03-02T13:55:50","modified_gmt":"2023-03-02T18:55:50","slug":"what-if-statements-6a","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/2023\/02\/24\/what-if-statements-6a\/","title":{"rendered":"What \u201cif\u201d statements 6a"},"content":{"rendered":"<p><span style=\"font-weight: 400\">We use if\/else statement to examine if the condition is true or false. If statements is where the condition of code is true. Else statement is same condition to be false. Lastly else if is for new test if the first condition is false. The basic syntax of if\/else statements is from class that helped me understand what if\/else statements are.<\/span><\/p>\n<p><span style=\"font-weight: 400\">if (something_is_true){<\/span><\/p>\n<p><span style=\"font-weight: 400\">do something;<\/span><\/p>\n<p><span style=\"font-weight: 400\">}else{<\/span><\/p>\n<p><span style=\"font-weight: 400\">do_something_different<\/span><\/p>\n<p><span style=\"font-weight: 400\">}<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u201cisNaN\u201d stands for is not-a-number when it\u2019s true its value is not a number. It helps converting \u201cthe value to a number before testing it\u201d for example\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">\/\/This returns true;<\/span><\/p>\n<p><span style=\"font-weight: 400\">isNaN(&#8216;Hello&#8217;);<\/span><\/p>\n<p><span style=\"font-weight: 400\">\/\/This returns false;<\/span><\/p>\n<p><span style=\"font-weight: 400\">Number.isNaN(&#8216;Hello&#8217;);<\/span><\/p>\n<p><span style=\"font-weight: 400\">To evaluate conditions \u201c&amp;&amp;\u201d \u201cif\u201d its true then the condition if block will be executed. False the else statement will be executed. With \u201c||\u201d if both are true the code inside the if statement will be executed.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Sources:\u00a0<\/span><a href=\"https:\/\/www.w3schools.com\/jsref\/jsref_if.asp#:~:text=Use%20if%20to%20specify%20a,the%20first%20condition%20is%20false\"><span style=\"font-weight: 400\">https:\/\/www.w3schools.com\/jsref\/jsref_if.asp#:~:text=Use%20if%20to%20specify%20a,the%20first%20condition%20is%20false<\/span><\/a><a href=\"https:\/\/www.w3schools.com\/jsref\/jsref_isnan.asp#:~:text=isNaN()%20returns%20true%20if,a%20number%20before%20testing%20it\"><span style=\"font-weight: 400\">https:\/\/www.w3schools.com\/jsref\/jsref_isnan.asp#:~:text=isNaN()%20returns%20true%20if,a%20number%20before%20testing%20it<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We use if\/else statement to examine if the condition is true or false. If statements is where the condition of code is true. Else statement is same condition to be false. Lastly else if is for new test if the first condition is false. The basic syntax of if\/else statements is from class that helped [&hellip;]<\/p>\n","protected":false},"author":29271,"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":[10531],"tags":[],"class_list":{"0":"post-3249","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-student-post","7":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3249","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\/29271"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/comments?post=3249"}],"version-history":[{"count":3,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3249\/revisions"}],"predecessor-version":[{"id":3876,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/posts\/3249\/revisions\/3876"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/media?parent=3249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/categories?post=3249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec730spring2023\/wp-json\/wp\/v2\/tags?post=3249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}