{"id":64,"date":"2006-11-02T10:40:45","date_gmt":"2006-11-02T15:40:45","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=64"},"modified":"2006-11-03T09:29:05","modified_gmt":"2006-11-03T14:29:05","slug":"bottom-line-on-logical","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2006\/11\/02\/bottom-line-on-logical\/","title":{"rendered":"Bottom Line on Logical"},"content":{"rendered":"<p>I just posted a blog on <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=61\">logical<\/a> operator behavior in MATLAB and I want to be clear about the bottom line.\r\n<\/p>\r\n<p>\r\nUse the newer MATLAB operators <kbd>||<\/kbd> and <kbd>&&<\/kbd>, <b>in the context of expressions for <kbd>if<\/kbd> and <kbd>while<\/kbd><\/b>.  The newer operators <b>always<\/b> short-circuit, not just in  <kbd>if<\/kbd> and  <kbd>while<\/kbd> expressions.  The newer operators force you to be clear about your intention with respect to matrix expressions (including empty ones) and <b>you<\/b> choose how to reduce the array expressions to scalar ones that are unambiguous. \r\n<\/p>","protected":false},"excerpt":{"rendered":"<p>I just posted a blog on logical operator behavior in MATLAB and I want to be clear about the bottom line.\r\n\r\n\r\nUse the newer MATLAB operators || and &#038;&, in the context of expressions for if and... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2006\/11\/02\/bottom-line-on-logical\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,14],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/64"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}