- A binary operator, often written
?:, that returns its first operand if that operand evaluates to a true value, and otherwise evaluates and returns its second operand. This is identical to a short-circuitorwith “last value” semantics. The notation of the Elvis operator was inspired by the ternary conditional operator,? :, since the Elvis operator expressionA ?: Bis approximately equivalent to the ternary conditionalA ? A : B. The name “Elvis operator” refers to the fact that when its common notation,?:, is viewed sideways, it resembles an emoticon of Elvis Presley with his signature hairstyle. ← Wikipedia
This term is sponsored by: your name/company?
- Previous term: else
- Next term: Em
- Random term: Tour of duty (webglossary.info/random 🎲)