What’s the standard line to add to the ternary operator in order to do nothing if the condition is not met?
int a = 0; a > 10 ? a = 5 : /*do nothing*/;
a seems to do the trick, but I am wondering if there is a more generally accepted way.
That will do it:
a = a > 10 ? 5 : a;
if (a > 10) a = 5;