An Entity of Type: Abstraction100002137, from Named Graph: http://dbpedia.org, within Data Space: dbpedia.org

In certain computer programming languages, the Elvis operator, often written ?:, 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:" class="mw-redirect" title="?:">? :</a> since the Elvis operator expression A ?: B is approximately equivalent to the ternary conditional A ? A : B.

Property Value
dbo:abstract
  • In certain computer programming languages, the Elvis operator, often written ?:, 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:" class="mw-redirect" title="?:">? :</a> since the Elvis operator expression A ?: B is approximately equivalent to the ternary conditional A ? 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. A similar operator is the null coalescing operator, where the boolean truth check is replaced with a check for non-null instead. This is usually written ??, and can be seen in languages like C#. (en)
  • エルビス演算子 (英語: elvis operator) は、いくつかのプログラミング言語にある演算子で、字句構文は ?: である。三項条件演算子 (? :) と違い、この連続する2文字で1つの演算子であり、意味的には三項演算子の第二項 (<i>A</i> ? <i>B</i> : <i>C</i>の<i>B</i>) が無いもの、というような機能を持っている。 Null合体演算子に似た制御機能を持つが、第一項の扱いが異なる。ただし、エルビス演算子にNull合体演算子の意味と役割を持たせている言語もある。 (ja)
  • 编程语言中,埃尔维斯运算符是一种二元运算符,常写为?:、or、||,如果第一操作数求值为真则返回其值,否则返回第二操作数的值。类似于带有“最后值”语义的短路求值。埃尔维斯运算符是受三元条件运算符 ? :启发而被提出的。因为埃尔维斯运算符表达式A ?: B近似于三元条件运算符A ? A : B。 埃尔维斯运算符得名于它的通常表示法?:,相似于埃尔维斯·普雷斯利(即“猫王”)的颜文字侧脸的,或者其他角度看相遇于他的得意的笑脸。 有一个相似的运算符是空值结合运算符,把布尔真值检查改为是否为空指针null。常写为??,如C#。 (zh)
dbo:wikiPageID
  • 41975647 (xsd:integer)
dbo:wikiPageLength
  • 7984 (xsd:nonNegativeInteger)
dbo:wikiPageRevisionID
  • 1121400697 (xsd:integer)
dbo:wikiPageWikiLink
dbp:wikiPageUsesTemplate
dcterms:subject
rdf:type
rdfs:comment
  • エルビス演算子 (英語: elvis operator) は、いくつかのプログラミング言語にある演算子で、字句構文は ?: である。三項条件演算子 (? :) と違い、この連続する2文字で1つの演算子であり、意味的には三項演算子の第二項 (<i>A</i> ? <i>B</i> : <i>C</i>の<i>B</i>) が無いもの、というような機能を持っている。 Null合体演算子に似た制御機能を持つが、第一項の扱いが異なる。ただし、エルビス演算子にNull合体演算子の意味と役割を持たせている言語もある。 (ja)
  • 编程语言中,埃尔维斯运算符是一种二元运算符,常写为?:、or、||,如果第一操作数求值为真则返回其值,否则返回第二操作数的值。类似于带有“最后值”语义的短路求值。埃尔维斯运算符是受三元条件运算符 ? :启发而被提出的。因为埃尔维斯运算符表达式A ?: B近似于三元条件运算符A ? A : B。 埃尔维斯运算符得名于它的通常表示法?:,相似于埃尔维斯·普雷斯利(即“猫王”)的颜文字侧脸的,或者其他角度看相遇于他的得意的笑脸。 有一个相似的运算符是空值结合运算符,把布尔真值检查改为是否为空指针null。常写为??,如C#。 (zh)
  • In certain computer programming languages, the Elvis operator, often written ?:, 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:" class="mw-redirect" title="?:">? :</a> since the Elvis operator expression A ?: B is approximately equivalent to the ternary conditional A ? A : B. (en)
rdfs:label
  • Elvis operator (en)
  • エルビス演算子 (ja)
  • 埃尔维斯运算符 (zh)
owl:sameAs
prov:wasDerivedFrom
foaf:isPrimaryTopicOf
is dbo:wikiPageDisambiguates of
is dbo:wikiPageWikiLink of
is foaf:primaryTopic of
Powered by OpenLink Virtuoso    This material is Open Knowledge     W3C Semantic Web Technology     This material is Open Knowledge    Valid XHTML + RDFa
This content was extracted from Wikipedia and is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License