HomeServicesBlogDictionariesContactSpanish Course
← Back to search

Meaning of safe navigation operator | Babel Free

Noun CEFR C1

Definitions

A binary operator that returns its second argument, unless the first argument is null, in which case it returns null; used to simplify code that would otherwise need multiple explicit checks for nullity.

Examples

“One operator I haven't talked about yet is the safe navigation operator (?.). By preceding a dot with a question mark, you can safely navigate to methods or properties of an object even if that object is null.”
“The safe navigation operator (?.) provides navigation on the nested properties without getting any exception when a null value is evaluated from any of the properties iterated.”
“C# 6 introduced a cascading nulls operator, also called the null-conditional operator and the safe navigation operator.”

CEFR level

C1
Advanced
This word is part of the CEFR C1 vocabulary — advanced level.

See also

Learn this word in context

See safe navigation operator used in real conversations inside our free language course.

Start Free Course