Apply short-circuit for logical operations.