How would i change this to be an if-else statment?

int endBr;
endBr = right ? right->intValue : beginBr + 1;
1
2
3
4
5
int endBr;
if (right)
    endBr = right->intValue;
else
    endBr = beginBr + 1;

This above is the equivalent syntax.

See: http://www.cplusplus.com/forum/articles/14631/
How to use the Conditional (ternary) operator for more details
Last edited on
Topic archived. No new replies allowed.