Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 && || operators on instructions
    primarykey
    data
    text
    <p>what does the operators evaluate on instructions?</p> <p>like:</p> <pre><code>var flag:Boolean=true; flag &amp;&amp; trace("1") &amp;&amp; trace("2") &amp;&amp; trace("3"); </code></pre> <p>output: 1 2 3</p> <pre><code>var flag:Boolean=true; flag &amp;&amp; trace("1") || trace("2") || trace("3"); </code></pre> <p>output 1</p> <p>The or operator breaks the sentence under idk what circumstances...</p> <p>Edit: ok, now i see how the sentence works with the operators, but is any instruction that doesn't have a return value valuated as true?</p> <p>And it appears u can't evaluate any instruction u want, like:</p> <pre><code>private function any():void{ true &amp;&amp; return; } </code></pre> <p>that will throw a compilation error.</p> <p>Edit: In this case, it behaves different to the second example:</p> <pre><code>true &amp;&amp; one() || two() || three(); </code></pre> <p>the functions</p> <pre><code>private function one():void{ trace("1"); } private function two():void{ trace("2"); } private function three():void{ trace("3"); } </code></pre> <p>output: 1 2 3</p> <p>Edit: Assigning values:</p> <pre><code>var a:int; (a=1) || trace("1"); (a=2) &amp;&amp; trace("2"); </code></pre> <p>output: 2</p> <p>Edit: <code>||</code> Returns expression1 if it is true or can be converted to true, and expression2 otherwise</p> <p><code>&amp;&amp;</code> "Returns expression1 if it is false or can be converted to false, and expression2 otherwise. Examples of values that can be converted to false are 0, NaN, null, and undefined".</p> <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#logical_OR" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#logical_OR</a></p> <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#logical_AND" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#logical_AND</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload