// longhand with if: int answer; if ( a > b ) { answer = 1; } else { answer = -1; } // can be written more tersely with the ternary operator as: int answer = a > b ? 1 : -1;