Ternary conditional operator
Conditional operator in computer programming
Conditional operator in computer programming
In computer programming, the ternary conditional operator is a conditional expression with three parts: the Boolean condition, the then-expression, and the else-expression. If the condition is true, the then-expression is evaluated; otherwise, the else-expression is evaluated; and the value is returned. Thus it is a non-strict operator, like other conditional expressions. It is also called a conditional operator, ternary if, immediate if, or inline if (iif). Although a ternary operator in general is any operator with three arguments, the three-argument conditional operator is the only common one in programming, so it is loosely called the ternary operator. C introduced the syntax a ? b : c, read as "if a then b otherwise c", which is widely used by other languages with C-like syntax. Some languages use functional syntax: in Visual Basic, it is written If(a, b, c). Many languages support conditional expressions with two, three, or more clauses. Languages following ALGOL-like syntax often...
Open boosters, collect cards and trade them. Free to play.
Play for free