Skip to content
EntityQ2984985· pop 14· linked from 67 articles

Also known as ternary conditional operator, inline if, shorthand conditional, ternary operator, ?: operator

ternary operator "x ? y : z" in many programming languages, whose value is y if x evaluates to true and z otherwise

Described at

Conditional (ternary) operator - JavaScript | MDN

The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy. This operator is frequently used as an alternative to an if...else statement.

developer.mozilla.org

Link to a page describing this subject · 8,590 chars · not written by Vinony

Wikidata facts

Show 1 more fact
Sources (1)

via Wikidata · CC0

Article · Português

Nas programação de computadores, ?: é um operador ternário que faz parte da sintaxe para uma expressão condicional básica, presente em várias linguagens de programação. É comumente referido referido como operador condicional, inline if (iif) ou ternary if. Ele originalmente veio da CPL, em que a sintaxe equivalente para <i>e</i><sub>1</sub> ? <i>e</i><sub>2</sub> : <i>e</i><sub>3</sub> era <i>e</i><sub>1</sub> → <i>e</i><sub>2</sub>, <i>e</i><sub>3</sub>. Embora sejam possíveis vários tipos de operadores ternários, o operador condicional é tão comum, enquanto os outros são mais raros, que o operador condicional é comumente (embora incorretamente) referido como o operador ternário.

Abstract from DBpedia / Wikipedia · CC BY-SA

Connections

Categories