The null coalescing operator is a binary operator that is part of the syntax for a basic conditional expression in several programming languages, such as (in alphabetical order): C#[1] since version 2.0,[2] Dart[3] since version 1.12.0,[4] PHP since version 7.0.0.[5], Perl since version 5.10 as logical defined-or,[6] PowerShell since 7.0.0,[7] and Swift[8] as nil-coalescing operator.
While its behavior differs between implementations, the null coalescing operator generally returns the result of its left-most operand if it exists and is not null, and otherwise returns the right-most operand. This behavior allows a default value to be defined for cases where a more specific value is not available.
In contrast to the ternary conditional if operator used as x ? x : y, but like the binary Elvis operator used as x ?: y, the null coalescing operator is a binary operator and thus evaluates its operands at most once, which is significant if the evaluation of x has side-effects.
^"?? and ??= operators - the null-coalescing operators". learn.microsoft.com.
^"ECMA-334, 3rd edition, June 2005" (PDF). ecma-international.org. Ecma International. June 2005. p. 63.
7.0.0, and Swift as nil-coalescingoperator. While its behavior differs between implementations, the nullcoalescingoperator generally returns the result...
hairstyle. A similar operator is the nullcoalescingoperator, where the boolean truth(iness) check is replaced with a check for non-null instead. This is...
navigation operator (also known as optional chaining operator, safe call operator, null-conditional operator, null-propagation operator) is a binary operator that...
type. JavaScript has a null and undefined values. Nullcoalescingoperator Semipredicate problem Union type Unit type "Nullable Types (C#)". Msdn.microsoft...
for null values, thereby freeing code that uses them from ever having to do so. Note that the example below uses the C# Nullcoalescingoperator to guarantee...
IIf, inline if function Nullcoalescingoperator, ?? operator Elvis operator, ?:, or sometimes ?., as a shorthand binary operator Conditioned disjunction...
returned. C# 8.0 introduces null-coalescing assignment, such that variable ??= otherwiseValue; is equivalent to if (variable is null) variable = otherwiseValue;...
SQL function that selects the first non-null from a range of values Nullcoalescingoperator, a binary operator that is part of the syntax for a basic...
modifier is used to handle nullable data types and ?? is the null coalescingoperator. In the POSIX syntax for regular expressions, such as that used in...
value is considered true, and its right operand if not Nullcoalescingoperator, an operator in computer programming Onion routing, anonymous networking...
languages, string concatenation is a binary infix operator, and in some it is written without an operator. This is implemented in different ways: Overloading...
the value of b is not null or undefined, otherwise it will be assigned 3. const a = b ?? 3; Before the nullish coalescingoperator, programmers would use...
Or alternatively, with the null-coalescing assignment operator ??= private int _myWidgetID; private Widget _myWidget = null; public Widget MyWidget { get...
working from left to right, or NULL if all the operands equal NULL. COALESCE(x1,x2) is equivalent to: CASE WHEN x1 IS NOT NULL THEN x1 ELSE x2 END The NULLIF...
literals are null-terminated; that is to say, a trailing null character as an end-of-string sentinel: const char *p; p = "the rain in Spain"; /* null-terminated...
the ** operator instead of Math.pow. The nullish coalescingoperator, ??, returns its right-hand side operand when its left-hand side is null or undefined...