Ternary operation

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Dexbot (talk | contribs) at 18:00, 16 April 2016 (Bot: Cleaning up old interwiki links). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In mathematics, a ternary operation is an n-ary operation with n = 3. A ternary operation on a set A takes any given three elements of A and combines them to form a single element of A. An example of a ternary operation is the product in a heap.

In computer science, a ternary operator is an operator that takes three arguments. The arguments and result can be of different types. Many programming languages that use C-like syntax feature a ternary operator, ?:, which defines a conditional expression. Since this operator is often the only existing ternary operator in the language, it is sometimes simply referred to as "the ternary operator". In some languages, this operator is referred to as "the conditional operator".

See also

References