In computer science, a ternary operator is an operator that takes three arguments as input and returns one output.
is an example of a ternary operation on the integers (or on any structure where
Properties of this ternary operation have been used to define planar ternary rings in the foundations of projective geometry.
In the Euclidean plane with points a, b, c referred to an origin, the ternary operation
[2] Since (abc) = d implies b – a = c – d, the directed line segments b – a and c – d are equipollent and are associated with the same free vector.
Any three points in the plane a, b, c thus determine a parallelogram with d at the fourth vertex.
In projective geometry, the process of finding a projective harmonic conjugate is a ternary operation on three points.
Point R and the line through P can be selected arbitrarily, determining C and D. Drawing AC and BD produces the intersection Q, and RQ then yields V. Suppose A and B are given sets and
Properties of this ternary relation have been used to set the axioms for a heap.
Many programming languages that use C-like syntax[4] feature a ternary operator, ?
In Python, the ternary conditional operator reads x if C else y. Python also supports ternary operations called array slicing, e.g. a[b:c] return an array where the first element is a[b] and last element is a[c-1].
[5] OCaml expressions provide ternary operations against records, arrays, and strings: a.
The Icon programming language has a "to-by" ternary operator: the expression 1 to 10 by 2 generates the odd integers from 1 through 9.