Top "Conditional-operator" questions

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

Returning null as an int permitted with ternary operator but not if statement

Let's look at the simple Java code in the following snippet: public class Main { private int temp() { return true ? null : 0; // …

java nullpointerexception conditional-operator autoboxing
What are the PHP operators "?" and ":" called and what do they do?

What are the ? and : operators in PHP? For example: (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER)

php syntax conditional conditional-operator
Java conditional operator ?: result type

I'm a bit puzzled about the conditional operator. Consider the following two lines: Float f1 = false? 1.0f: null; Float f2 = …

java nullpointerexception type-conversion conditional-operator
Why is this code invalid in C#?

The following code will not compile: string foo = "bar"; Object o = foo == null ? DBNull.Value : foo; I get: Error 1 Type …

c# nullable conditional-operator dbnull
Does F# have the ternary ?: operator?

I'm learning F# coming from C# and I've just tried compiling an expression like let y = Seq.groupBy (fun x …

f# conditional-operator
Why does "sizeof(a ? true : false)" give an output of four bytes?

I have a small piece of code about the sizeof operator with the ternary operator: #include <stdio.h> #…

c boolean sizeof conditional-operator c11
Conditional Excel Sum based on dates range

I have got a spreadsheet in where dates are in column B and values are in column E. Dates are …

excel worksheet-function conditional-operator sumifs
Is there, or is there ever going to be, a conditional operator in Delphi?

I kept my hands off Delphi for too long, I guess; busied myself with Java and PHP a lot over …

delphi delphi-2009 language-features conditional-operator
Why does C not allow concatenating strings when using the conditional operator?

The following code compiles without problems: int main() { printf("Hi" "Bye"); } However, this does not compile: int main() { int test = 0; …

c string syntax concatenation conditional-operator
Short circuiting statement evaluation -- is this guaranteed? [C#]

Quick question here about short-circuiting statements in C#. With an if statement like this: if (MyObject.MyArray.Count == 0 || MyObject.MyArray[0].…

c# conditional-operator logical-operators short-circuiting