Remove ads

數學三元運算子是輸入為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.

Remove ads