// Never: if ( x == 1 || x == 0 ) { ... } // But: if ( ! ( ( x != 1 ) && ( x != 0 ) ) ) { ... } // (parentheses added for clarity!)