According to Wikipedia, the binary operator ?:
is
colloquially referred to as the Elvis operator due to its resemblance to an emoticon.
My question is:
Elvis operator (?:) is used to return the not null value even the conditional expression is null. It is also used to check the null safety of values. In some cases, we can declare a variable which can hold a null reference.
In computer programming, ?: is a ternary operator that is part of the syntax for basic conditional expressions in several programming languages. It is commonly referred to as the conditional operator, inline if (iif), or ternary if. An expression a ? b : c evaluates to b if the value of a is true, and otherwise to c .
Elvis Operator (?:)It is used to return the not null value even the conditional expression is null. It is also used to check the null safety of values. In some cases, we can declare a variable which can hold a null reference.
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.
Kotlin Elvis Operator (?:) Elvis Operator (?:) It is used to return the not null value even the conditional expression is null. It is also used to check the null safety of values. In some cases, we can declare a variable which can hold a null reference.
More likely, it is from the rare surname Elvis, a variant of Elwes, which is ultimately derived from the given name Eloise. The name was brought to public attention by the singer Elvis Presley (1935-1977), whose name came from his father's middle name. This name is also used as an Anglicized form of Irish Ailbhe.
operator (n.) 1590s, "one who performs mechanical or surgical operations," agent noun from operate (v.) or from Late Latin operator "a worker." Meaning "one who carries on business shrewdly" is from 1828. Specific sense of "one who works a telephone switchboard" (1884) grew out of earlier meaning "one who works a telegraph" (1847).
Yes, it relates to Elvis Presley because it kinda resembles his hair style:
Reference: https://stackoverflow.com/a/1993455/432311
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With