<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.lalex.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>LAlex devblog v6 - Optimisation des conditions booléennes avec opérateurs logiques  - Commentaires</title>
  <link>http://blog.lalex.com/</link>
  <atom:link href="http://blog.lalex.com/feed/rss2/comments/172" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Fri, 28 Nov 2008 07:30:10 +0100</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - Andreas Weber</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c771</link>
    <guid isPermaLink="false">urn:md5:61a504b7ad216639ba43189cf043a93e</guid>
    <pubDate>Sat, 21 Feb 2004 12:13:00 +0000</pubDate>
    <dc:creator>Andreas Weber</dc:creator>
    
    <description>&lt;p&gt;function say1(what){&lt;br /&gt;
	trace(what || 'well, just anything');&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;C'est joli! Mais je préfère le classique 'ternary statement':&lt;/p&gt;
&lt;p&gt;function say2(what){&lt;br /&gt;
        trace(what ? what : 'well, just anything');&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;say1('something');&lt;br /&gt;
say1();&lt;/p&gt;
&lt;p&gt;say2('something');&lt;br /&gt;
say2();&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - ekameleon</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c708</link>
    <guid isPermaLink="false">urn:md5:b2d449ee78961bf7b3a7070af99bd8e7</guid>
    <pubDate>Thu, 29 Jan 2004 22:49:31 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;vaudrait mieux pas &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - monsieurfil</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c706</link>
    <guid isPermaLink="false">urn:md5:9fc3a042a6d2e9826e8edc738269d50d</guid>
    <pubDate>Thu, 29 Jan 2004 16:37:29 +0000</pubDate>
    <dc:creator>monsieurfil</dc:creator>
    
    <description>&lt;p&gt;Il me semble que sur MAC, le plugin Flash évalue les chaines à vrai lorsque sur PC c'est évalué à faux !&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - ekameleon</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c705</link>
    <guid isPermaLink="false">urn:md5:08d87ff2d52c247c0a882f0ab021d680</guid>
    <pubDate>Thu, 29 Jan 2004 15:40:38 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;sur MAC quel rapport &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt; ??? &lt;br /&gt;Par contre en effet on a :&lt;br /&gt;&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; a = x || &lt;span style=&quot;color: #cc66cc;&quot;&gt;15&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; b = x || &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;coucou&amp;quot;&lt;/span&gt; ; &lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; c = x || &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; d = x || &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;a : &amp;quot;&lt;/span&gt; + a + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; --&amp;gt; Bool(a) : &amp;quot;&lt;/span&gt; + &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;a&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;b : &amp;quot;&lt;/span&gt; + b + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; --&amp;gt; Bool(a) : &amp;quot;&lt;/span&gt; + &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;b&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;c : &amp;quot;&lt;/span&gt; + c + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; --&amp;gt; Bool(a) : &amp;quot;&lt;/span&gt; + &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;d : &amp;quot;&lt;/span&gt; + d + &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; --&amp;gt; Bool(a) : &amp;quot;&lt;/span&gt; + &lt;span style=&quot;color: #0066CC;&quot;&gt;Boolean&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;d&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/* ----- sorties&lt;br /&gt;
FLASH 5 &lt;br /&gt;
a : 15 --&amp;gt; Bool(a) : true&lt;br /&gt;
b : coucou --&amp;gt; Bool(a) : false&lt;br /&gt;
c : true --&amp;gt; Bool(a) : true&lt;br /&gt;
d : false --&amp;gt; Bool(a) : false&lt;br /&gt;
FLASH 6 &lt;br /&gt;
a : 15 --&amp;gt; Bool(a) : true&lt;br /&gt;
b : coucou --&amp;gt; Bool(a) : false&lt;br /&gt;
c : true --&amp;gt; Bool(a) : true&lt;br /&gt;
d : false --&amp;gt; Bool(a) : false&lt;br /&gt;
FLASH 7 (AS1)&lt;br /&gt;
a : 15 --&amp;gt; Bool(a) : true&lt;br /&gt;
b : coucou --&amp;gt; Bool(a) : true&lt;br /&gt;
c : true --&amp;gt; Bool(a) : true&lt;br /&gt;
d : false --&amp;gt; Bool(a) : false&lt;br /&gt;
---- */&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;bye &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - monsieurfil</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c704</link>
    <guid isPermaLink="false">urn:md5:4731ec3151c85090e941ccd44b757e25</guid>
    <pubDate>Thu, 29 Jan 2004 15:26:44 +0000</pubDate>
    <dc:creator>monsieurfil</dc:creator>
    
    <description>&lt;p&gt;&lt;quote&gt;A priori, tout ce qui n'est pas 0 ou false ou undefined est évalué à true &lt;/quote&gt;&lt;/p&gt;&lt;p&gt;Et ben (en AS1 en tout cas) une chaine de caractères est évalué à faux (mais c'est le contraire sur MAC je crois).&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - neo-lao</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c703</link>
    <guid isPermaLink="false">urn:md5:bdb8a52ad86993a58cf56b06c0f176f5</guid>
    <pubDate>Thu, 29 Jan 2004 13:18:58 +0000</pubDate>
    <dc:creator>neo-lao</dc:creator>
    
    <description>&lt;p&gt;lol ah mais chui bête, j'avais meme pas vu le code, j'ai répondu direct&lt;br /&gt;scuzé ... j'vais retourner à Final leveler mon White Mage ....&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - neo-lao</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c702</link>
    <guid isPermaLink="false">urn:md5:e1b0b2f3b21280bcdd20c404536b206f</guid>
    <pubDate>Thu, 29 Jan 2004 13:17:31 +0000</pubDate>
    <dc:creator>neo-lao</dc:creator>
    
    <description>&lt;p&gt;au fait, c'est marqué où que le reste de la condition n'est pas traité ?&lt;br /&gt;il y a certain langage qui traite tout &quot;bêtement&quot;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - LAlex</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c701</link>
    <guid isPermaLink="false">urn:md5:3289c92dc96df08859b16ec787439122</guid>
    <pubDate>Thu, 29 Jan 2004 13:12:51 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;A priori, tout ce qui n'est pas 0 ou &lt;em&gt;false&lt;/em&gt; ou &lt;em&gt;undefined&lt;/em&gt; est évalué à &lt;strong&gt;true&lt;/strong&gt; ... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;++ ^^&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - monsieurfil</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c700</link>
    <guid isPermaLink="false">urn:md5:6696dd261db70c59893221351c2b6792</guid>
    <pubDate>Thu, 29 Jan 2004 12:35:35 +0000</pubDate>
    <dc:creator>monsieurfil</dc:creator>
    
    <description>&lt;p&gt;Un grand classique en programmation qui vaut le coup d'être rappelé !&lt;/p&gt;&lt;p&gt;&lt;quote&gt;function parler (phrase:String) {&lt;br /&gt;     trace ( phrase || &quot;rien à dire&quot;) ;&lt;br /&gt;}&lt;br /&gt;&lt;/quote&gt;&lt;br /&gt;En AS2, les chaines de caractères sont evaluées 'true' ?&lt;br /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - stef</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c699</link>
    <guid isPermaLink="false">urn:md5:1865a33041b2994100d7d557ade32b54</guid>
    <pubDate>Wed, 28 Jan 2004 11:45:43 +0000</pubDate>
    <dc:creator>stef</dc:creator>
    
    <description>&lt;p&gt;Tiens, je me suis souvent posé la question sans jamais approfondir! Je ne savais pas s'il s'arrêtait après la première évaluation ou s'il testait tout de même bêtement les deux.&lt;br /&gt;Je suis bien content d'apprendre cela, très bon à savoir!&lt;/p&gt;&lt;p&gt;Merde, la tonne de code que je dois réviser là... ouch!&lt;/p&gt;&lt;p&gt;Merci beaucoup pour l'info!&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Optimisation des conditions booléennes avec opérateurs logiques - ekameleon</title>
    <link>http://blog.lalex.com/post/2004/01/28/Optimisation-des-conditions-boolennes-avec-oprateurs-logiques#c698</link>
    <guid isPermaLink="false">urn:md5:f52b5a0f37c558ce16d1d7497c8ecd44</guid>
    <pubDate>Wed, 28 Jan 2004 09:57:26 +0000</pubDate>
    <dc:creator>ekameleon</dc:creator>
    
    <description>&lt;p&gt;je me sert beaucoup de cette propriété dans des initialisations de propriétés ... par exemple :&lt;br /&gt;&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; parler &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;phrase:&lt;span style=&quot;color: #0066CC;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; phrase || &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;rien à dire&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
parler &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;coucou&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// sortie : coucou&lt;/span&gt;&lt;br /&gt;
parler &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// sortie : rien à dire &lt;/span&gt;&lt;/code&gt;&lt;br /&gt;si on inverse l'ordre des conditions dans l'expression on n'obtient forcément pas le bon résultat.&lt;br /&gt;Donc faut faire attention &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt; &lt;br /&gt;bye &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
</channel>
</rss>