<?xml version="1.0" encoding="windows-1252"?>
<node id="1013150" title="Re: Operator precedence" created="2013-01-13 22:08:08" updated="2013-01-13 22:08:08">
<type id="11">
note</type>
<author id="647953">
sundialsvc4</author>
<data>
<field name="doctext">
&lt;p&gt;
These two operators exhibit what is called &lt;b&gt;&lt;i&gt;short-circuit&lt;/i&gt; evaluation&lt;/b&gt;. &amp;nbsp; If the left-hand side of &lt;tt&gt;&amp;&amp;&lt;/tt&gt; is found to be False, the right-hand side is not evaluated at all, since to do so would be pointless: &amp;nbsp; &amp;ldquo;False &lt;tt&gt;and&lt;/tt&gt; anything-at-all is already known to be False.&amp;rdquo; &amp;nbsp; Likewise, if the left-hand side of &lt;tt&gt;||&lt;/tt&gt; is found to be True, then the right-hand side is not evaluated since what it&amp;rsquo;s got is already sufficient: &amp;nbsp; &amp;ldquo;True &lt;tt&gt;or&lt;/tt&gt; anything-at-all is already known to be True.&amp;rdquo;
&lt;/p&gt;&lt;p&gt;
The computer had to evaluate &lt;tt&gt;apple&lt;/tt&gt; to conclude if it was True or False. &amp;nbsp; (It was True.) &amp;nbsp; Since it was True, short-circuiting did not occur so it proceeded to its rightmost part. &amp;nbsp; But, having evaluated &lt;tt&gt;banana&lt;/tt&gt; in the parenthesized expression (also True), that &lt;em&gt;did&lt;/em&gt; short-circuit: &amp;nbsp; within that subexpression, it did not have to go further. &amp;nbsp; A call to &lt;tt&gt;cherry&lt;/tt&gt; will never occur in this program fragment as-written.
&lt;/p&gt;</field>
<field name="root_node">
1013066</field>
<field name="parent_node">
1013066</field>
</data>
</node>
