...
This compliant solution mitigates the problem by using &&
, which causes the evaluation of the conditional expression to terminate immediately if any of the conditions fail, thereby preventing a runtime exception.
...
Nevertheless, this solution is preferable if when the error-handling code for each potential condition failure were is different.
Noncompliant Code Example (Improper &&
)
...