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.

?: ?? Operators Instead Of IF|ELSE

public string Source { get { /* if ( Source == null ){ return string . Empty; } else { return Source; } */ return Source ?? string.Empty; } set { /* if ( Source == …

c# ternary-operator
What is the idiomatic Go equivalent of C's ternary operator?

In C/C++ (and many languages of that family), a common idiom to declare and initialize a variable depending on …

go ternary-operator conditional-operator
What does '?' do in C++?

int qempty() { return (f == r ? 1 : 0); } In the above snippet, what does "?" mean? What can we replace it with?

c++ operators ternary-operator
Ternary operator in AngularJS templates

How do you do a ternary with AngularJS (in the templates)? It would be nice to use some in html …

javascript html angularjs ternary-operator
What is the Java ?: operator called and what does it do?

I have been working with Java a couple of years, but up until recently I haven't run across this construct: …

java syntax ternary-operator conditional-operator
Angularjs if-then-else construction in expression

Can I somehow use if-then-else construction (ternary-operator) in angularjs expression, for example I have function $scope.isExists(item) that has …

javascript angularjs if-statement angularjs-ng-repeat ternary-operator
PHP ternary operator vs null coalescing operator

Can someone explain the differences between ternary operator shorthand (?:) and null coalescing operator (??) in PHP? When do they behave differently …

php php-7 ternary-operator null-coalescing-operator
Ternary operator in PowerShell

From what I know, PowerShell doesn't seem to have a built-in expression for the so-called ternary operator. For example, in …

powershell ternary-operator conditional-operator
Conditional statement in a one line lambda function in python?

Apologies if this has been asked before, but I couldn't see it anywhere. Essentially I've come across a scenario where …

python if-statement lambda ternary-operator conditional-operator
PHP syntax question: What does the question mark and colon mean?

Possible Duplicate: quick php syntax question return $add_review ? FALSE : $arg; What do question mark and colon mean? Thanks

php syntax ternary-operator