Elvis operator

:, is a binary operator that evaluates its first operand and returns it if its value is logically true (according to a language-dependent convention, in other words, a truthy value), and otherwise evaluates and returns its second operand.

:, is viewed sideways, it resembles an emoticon of Elvis Presley with his signature hairstyle.

[3] In several languages, such as Common Lisp, Clojure, Lua, Object Pascal, Python, Ruby, and JavaScript, there is no need for the Elvis operator, because the language's logical disjunction operator (typically || or or) is short-circuiting and returns the its first operand if it would evaluate to a truthy value, and otherwise its second operand, which may be a truthy or falsy value (rather than a Boolean true or false value, such as in C and C++).

It is equivalent to this example, using the conditional ternary operator: except that it does not evaluate f() twice if it yields truthy.

Note the possibility of arbitrary behaviour if f() is not a state-independent function that always returns the same result.