cpp short if code example
Example 1: c++ short if
(condition) ? (if_true) : (if_false)
Example 2: c++ ternary statement
x = condition ? expression1 : expression2
// Example:
double x = 1 > 0 ? 10 : 20; // put any value
(condition) ? (if_true) : (if_false)
x = condition ? expression1 : expression2
// Example:
double x = 1 > 0 ? 10 : 20; // put any value