数学三元运算符是输入为3个自变量的运算。计算机科学中的三元运算符是有3个操作数的运算符。[1]

计算机科学

C语言为代表的一些编程语言定义的条件表达式?:即为三元运算符表达式。[2]

Python语言中三元条件运算符表达式x if C else y。Python还支持列表的切片操作也是三元运算符,如a[b:c][3] OCaml的三元运算符表达式a.[b]<-c表示字符串a的索引b有值c[4]

SQL的between也是三元运算符。

参考文献

Wikiwand in your browser!

Seamless Wikipedia browsing. On steroids.

Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.

Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.