Elvis operator

In certain computer programming languages, the Elvis operator, often written ?:, or or ||, is a binary operator 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-circuit or with "last value" semantics. The notation of the Elvis operator was inspired by the ternary conditional operator, <a href="/wiki/%3F:" title="?:">? :</a> since the Elvis operator expression A ?: B is approximately equivalent to the ternary conditional A ? A : B.

Elvis operator

In certain computer programming languages, the Elvis operator, often written ?:, or or ||, is a binary operator 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-circuit or with "last value" semantics. The notation of the Elvis operator was inspired by the ternary conditional operator, <a href="/wiki/%3F:" title="?:">? :</a> since the Elvis operator expression A ?: B is approximately equivalent to the ternary conditional A ? A : B.