vendredi 8 janvier 2016

C# How to check which part of an if statement is correct

i wonder how can you check which part of a if statement was the correct one for example if you have this :

int a = 1, b, c, d;
    if(a > 0 || b > 1 || c > 2 || d > 3)
    {
        //do stuff
    }

Now in this case the one that made the if correct is a. So how can you verify this ? Basically you can put them in 4 different if's but if you have to do a repetitive code for each one you can probably come up with some method for it but isn't there actually a way to pass some value for example ?

Aucun commentaire:

Enregistrer un commentaire