Check both conditions in an if statement even if the first one is false

Viewed 4286

I have two statements in an if block that both link to a function that will return a bool. Both statements must be true for the code to run but I want them both to be checked even if the first one is false. The relevant code:

if (myFunc(one) && myFunc(two)) {
    //execute
}

myFunc will execute some code before returning false, but this code is not executed on two if one returns false.

I got this to work, but it feels like a hack:

if ((myFunc(one) && myFunc(two)) || (myFunc(two) && myFunc(one))) {
    //execute
}

Does anyone have a better solution? Thanks!

2 Answers
Related