First instance that an if statement is satisfied?
<p>Here is a simplification of what I am trying to do. Basically, x will always equal f1, y = f2, etc. In the case where x=/=y=/=z, my code works. But if any two (or more) or x, y and z are equal, then this code doesn't work.</p>

<p>Constructor for class Base_Class:</p>

<pre><code>Base_Class(double f){

    double x=1, y=2, z=3;  

    if(f == x)
        do something
    else if(f == y)
        do something else
    else if(f == z)
        do something else

}
</code></pre>

<p>I want to do</p>

<pre><code>Base_Class f1=1, f2=1, f3=1;
</code></pre>

<p>I'm confused why this doesn't work though with the if statements above. Aren't all of the if clauses technically satisfied?</p>

<p>Edit: if x=y (i.e. f1=f2), then I want to use if(f == x) clause for f1 and if(f == y) clause for f2.</p>

<p>If x=z (i.e. f1=f3), then use if(f == x) for f1 and if(f == z) for f3.</p>

<p>And if x=y=z (f1=f2=f3), use if(f == x) for f1, if(f == y) for f2, and if (f == y) for f3.</p>
