Global Information Lookup Global Information

Null coalescing operator information


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.

  1. ^ "?? and ??= operators - the null-coalescing operators". learn.microsoft.com.
  2. ^ "ECMA-334, 3rd edition, June 2005" (PDF). ecma-international.org. Ecma International. June 2005. p. 63.
  3. ^ "Conditional expression".
  4. ^ "Dart SDK Changelog, 1.12.0". github.com. 2015-08-31.
  5. ^ "PHP: News Archive - 2015". php.net.
  6. ^ "perlop - perldoc.perl.org". perldoc.perl.org.
  7. ^ "PowerShell 7 Preview 5". PowerShell. 2019-10-23. Retrieved 2020-02-15.
  8. ^ "The Swift Programming Language (Swift 5): Basic Operators: Nil-Coalescing Operator". docs.swift.org.

and 20 Related for: Null coalescing operator information

Request time (Page generated in 0.8583 seconds.)

Null coalescing operator

Last Update:

7.0.0, and Swift as nil-coalescing operator. While its behavior differs between implementations, the null coalescing operator generally returns the result...

Word Count : 2180

Elvis operator

Last Update:

hairstyle. A similar operator is the null coalescing operator, where the boolean truth(iness) check is replaced with a check for non-null instead. This is...

Word Count : 923

Safe navigation operator

Last Update:

navigation operator (also known as optional chaining operator, safe call operator, null-conditional operator, null-propagation operator) is a binary operator that...

Word Count : 1389

Nullable type

Last Update:

type. JavaScript has a null and undefined values. Null coalescing operator Semipredicate problem Union type Unit type "Nullable Types (C#)". Msdn.microsoft...

Word Count : 704

Null object pattern

Last Update:

for null values, thereby freeing code that uses them from ever having to do so. Note that the example below uses the C# Null coalescing operator to guarantee...

Word Count : 2801

Ternary conditional operator

Last Update:

IIf, inline if function Null coalescing operator, ?? operator Elvis operator, ?:, or sometimes ?., as a shorthand binary operator Conditioned disjunction...

Word Count : 6080

C Sharp syntax

Last Update:

returned. C# 8.0 introduces null-coalescing assignment, such that variable ??= otherwiseValue; is equivalent to if (variable is null) variable = otherwiseValue;...

Word Count : 10353

Coalescence

Last Update:

SQL function that selects the first non-null from a range of values Null coalescing operator, a binary operator that is part of the syntax for a basic...

Word Count : 402

PHP syntax and semantics

Last Update:

supports Null coalescing operator (??). $a = $b ?? $c; /* Equivalent to */ $a = isset($b) ? $b : $c; Since version 7.4 PHP also supports Null coalescing operator...

Word Count : 3561

Question mark

Last Update:

modifier is used to handle nullable data types and ?? is the null coalescing operator. In the POSIX syntax for regular expressions, such as that used in...

Word Count : 3584

Or

Last Update:

value is considered true, and its right operand if not Null coalescing operator, an operator in computer programming Onion routing, anonymous networking...

Word Count : 502

PHP

Last Update:

a number of scenarios. For example, the nullsafe operator is similar to the null coalescing operator ??, but used when calling methods. The following...

Word Count : 11804

Concatenation

Last Update:

languages, string concatenation is a binary infix operator, and in some it is written without an operator. This is implemented in different ways: Overloading...

Word Count : 944

JavaScript syntax

Last Update:

the value of b is not null or undefined, otherwise it will be assigned 3. const a = b ?? 3; Before the nullish coalescing operator, programmers would use...

Word Count : 10273

Lazy loading

Last Update:

Or alternatively, with the null-coalescing assignment operator ??= private int _myWidgetID; private Widget _myWidget = null; public Widget MyWidget { get...

Word Count : 801

SQL syntax

Last Update:

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...

Word Count : 3831

Comparison of Pascal and C

Last Update:

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...

Word Count : 6383

ECMAScript version history

Last Update:

the ** operator instead of Math.pow. The nullish coalescing operator, ??, returns its right-hand side operand when its left-hand side is null or undefined...

Word Count : 2763

Comparison of programming languages by type system

Last Update:

Object-oriented constructors Operators Ternary conditional operator Null coalescing operators Safe navigation operators Modulo operators Evaluation strategy List...

Word Count : 363

Comparison of programming languages

Last Update:

Object-oriented constructors Operators Ternary conditional operator Null coalescing operators Safe navigation operators Modulo operators Evaluation strategy List...

Word Count : 1461

PDF Search Engine © AllGlobal.net