Top "Ternary-operator" questions

The conditional operator is a ternary operator that is part of the syntax for a basic conditional expression in several programming languages.

Count the number of true members in an array of boolean values

New to javascript and I'm having trouble counting the number of trues in an array of boolean values. I'm trying …

javascript arrays ternary-operator reduce
Java Ternary without Assignment

Is there a way to do a java ternary operation without doing an assignment or way to fake the assingment? …

java ternary-operator ternary
?: ternary conditional operator behaviour when leaving one expression empty

I was writing a console application that would try to "guess" a number by trial and error, it worked fine …

c ternary-operator conditional-operator ternary
JSF EL nested ternary operator

I have JSF 2.2, PrimeFaces 5.0 web application. On my page I need to conditionally set <ui:param/>. The problem …

jsf el facelets ternary-operator
Simulate ternary operator in Elixir

How to do the similar conditional one-line check in Elixir? if (x > 0) ? x : nil Is this the only equivalent …

elixir ternary-operator
C#'s null coalescing operator (??) in PHP

Is there a ternary operator or the like in PHP that acts like ?? of C#? ?? in C# is clean and …

php ternary-operator null-coalescing-operator php-7
Ruby ternary operator in erb?

How can I make this code look better: <%=raw manuscript.uploaded_to_s3? ? "<span style=\"color:green;\">" : "&…

ruby ruby-on-rails-3 erb ternary-operator
C conditional operator ('?') with empty second parameter

Typically the '?' operator is used in the following form: A ? B : C However in cases where B = A …

c operators conditional ternary-operator
Java ternary operator vs if/else in <JDK8 compatibility

Recently I'm reading the source code of Spring Framework. Something I can't understand goes here: public Member getMember() { // NOTE: no …

java java-8 ternary-operator
Ternary operator left associativity

In the PHP manual, I find the following 'user contributed note' under "Operators". Note that in php the ternary operator ?: …

php ternary-operator associativity