0 votes
12 views
What is the use of double question mark “??” in swift?
in Technology by (186k points)

1 Answer

0 votes
The double question mark “??” is a nil-coalescing operator, it is mainly a shorthand for the ternary conditional operator where we used to test for nil. A double question mark is also used to provide a default value for a variable.

stringVar ?? “default string”

This exactly does the common thing, if stringVar is not nil then it is returned, otherwise the “default string” is returned.
by (186k points)

Related questions

0 votes
1 answer 14 views
0 votes
1 answer 42 views
0 votes
1 answer 9 views
0 votes
1 answer 11 views
11 views asked Nov 1, 2020 in Technology by JackTerrance (186k points)
0 votes
1 answer 21 views
0 votes
1 answer 18 views
0 votes
1 answer 25 views
0 votes
1 answer 27 views
0 votes
1 answer 19 views
0 votes
1 answer 20 views
0 votes
1 answer 15 views
0 votes
1 answer 12 views
0 votes
1 answer 16 views
0 votes
1 answer 10 views
0 votes
1 answer 12 views
12 views asked Nov 10, 2020 in Technology by JackTerrance (186k points)
0 votes
1 answer 27 views
0 votes
1 answer 12 views
0 votes
1 answer 55 views
...