I have a switch statement in a tight loop that looks like this:
switch(true) {
case /*expensive comparison */:
case /*another expensive comparison */:
case /*different expensive comparison */:
return true;
}
return false;
I looking to see if any of the expensive comparisons is true, but only one. I know there are other ways to accomplish this, but this one looks nice and clean. The real question is: if expensive comparison
evaluates to true, does it also run another expensive comparison
also, or just jump to the return?
EDIT: I realize this could be accomplished with a simple or statement, but now I want to know for theory's sake.
return /*expensive comparison */
|| /*another expensive comparison */
|| /*different expensive comparison */;