Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, be very <strong>attentive</strong> when reading such "anti" campaigns. </p> <ul> <li>Ask yourself if <em>Anti IF</em> campaign would like eliminate the <strong><em>logic</em></strong> in the applications?!</li> <li>The ideas could have a good application in <em>one</em> situation and a stupid in <em>another one</em>. <em>Be reasonable.</em></li> <li>It may be possible that <em>multiple</em> usage of <strong>IF</strong> may encumber the reader of the code. but this is <em>any</em> reason to eliminate the <strong>if</strong> from your code, more that than, this is almost impossible. </li> <li>By the way anywhere in the MS design guidelines is indicated do not use <strong>if</strong> (like is done, by e.g. for the <strong>goto</strong> statement usage of witch is not recommended)...</li> </ul> <p>C#</p> <pre><code> switch (myStringVar) { case "one": doSomething(); break; case "two": doSomething(); break; case "three": doSomething(); break; default: doSomething(); break; } </code></pre> <p>Finally, it reduces this code to the <strong>if</strong> s... so, only for readability is better, not for performance.</p> <p>Actually, if Microsoft believes that switch (in c#) is better to replace with if's - OK, I will use (in the concrete situation that you described) the <strong>switch</strong>.</p> <p>By the way, it seems that the campaign responds to your question very clear <a href="http://www.antiifcampaign.com/articles/the-simplest-anti-if-code.html" rel="nofollow noreferrer">in this example</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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