I’m wondering if it’s possible to do something along those lines:
boolExpression ? firstStatement : noStatement;
However, when I do this I get an error:
isBar() ? foo() : ;
I’m wondering if it’s possible to do something along those lines:
boolExpression ? firstStatement : noStatement;
However, when I do this I get an error:
isBar() ? foo() : ;
The ?: operator is called the ternary operator, because it takes three arguments. So, to answer your question, no.
But, is it so bad to have to write if(IsBar()) Foo(); ?