How to use the double question mark ??
Double question mark
What is the context of your question ?
- In the developers forum ??
- In Swift (nil coalescing operator) => explained in detail in Swift language
« Nil-Coalescing Operator The nil-coalescing operator (a ?? b) unwraps an optional a if it contains a value, or returns a default value b if a is nil. The expression a is always of an optional type. The expression b must match the type that is stored inside a.
The nil-coalescing operator is shorthand for the code below:
a != nil ? a! : b
The code above uses the ternary conditional operator and forced unwrapping (a!) to access the value wrapped inside a when a is not nil, and to return b otherwise. The nil-coalescing operator provides a more elegant way to encapsulate this conditional checking and unwrapping in a concise and readable form.
NOTE If the value of a is non-nil, the value of b is not evaluated. This is known as short-circuit evaluation.»
« The Swift Programming Language » Apple Books.
- other ?