タグ

programming-languageとconditional-operatorに関するnabinnoのブックマーク (2)

  • Elvis operator - Wikipedia

    This article is about the use of a ?: operator as a binary operator. For use as a ternary operator, see ?:. Elvis Presley, whose hair resembles the operator viewed sideways In certain computer programming languages, the Elvis operator, often written ?:, is a binary operator that evaluates its first operand and returns it if its value is logically true (according to a language-dependent convention,

    Elvis operator - Wikipedia
  • 条件演算子 - Wikipedia

    条件演算子(じょうけんえんざんし、英: conditional operator)は、プログラミング言語の演算子で、条件文と同様な意味があるが、文ではなく値を持つ式になる。評価されると、条件式の値により異なる式が評価され、異なる値になる。 なお、C言語やC++など一部のプログラミング言語において、条件演算子とは後述する「? :」(ハテナマークとコロン) の演算子の名称である。 「If 〜 Then 〜 Else 〜」にあたる三項演算子があり、ほぼ唯一の、プログラミング言語において一般的な三項演算子である。また「If 〜 Then 〜 if」にあたる二項演算子もある。 三項演算子は、条件式・真式・偽式の3つのオペランドを結ぶ。二項演算子の場合は、条件式と、真式または偽式のいずれかの、2つのオペランドを結ぶ。 条件文との違いは、 真式・偽式は式(条件文における節のように文を置くことができない)

  • 1