Ternary operation
In mathematics, a ternary operation is any operation of arity three, that is, that takes three arguments.In programming, especially in the C programming language, the "? :" operator is a ternary operator.
It takes in a boolean value, and two statements, and returns the return value of the first statement if the boolean value is true, and the return value of the second statement if the boolean value is false.
For example, z = (x > y) ? x : y; assigns x to z if x is greater than y, and otherwise assigns y to z (the statement sets z equal to the maximum of x and y).
Some programmers regard using this ternary operator as bad practice, though it can be useful in certain circumstances to avoid excessive if statements.