Elvis operator

In certain computer programming languages, the Elvis operator, often written ? :, is a binary operator that returns the first operand if its value is logically true (according to a language-dependent convention, in other words, a truthy value) or returns its second operand if the first operand is not true. That is, it is a short-circuit OR, which returns its first truthy operand.

Source: Wikipedia — Elvis operator (CC BY-SA 4.0)

Elvis operator

In certain computer programming languages, the Elvis operator, often written ? :, is a binary operator that returns the first operand if its value is logically true (according to a language-dependent convention, in other words, a truthy value) or returns its second operand if the first operand is not true. That is, it is a short-circuit OR, which returns its first truthy operand.

Source: Wikipedia "Elvis operator" · CC BY-SA 4.0

Share this article: X · Bluesky
Privacy Policy