in Technology by
What is the use of double question mark “??” in swift?

1 Answer

0 votes
by
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.

Related questions

0 votes
    who will answer this question I will mark as brainlist 1)what are the available options to set the layout of the form? Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    Wt is coding classes please help me in this question give a valid answer please I will mark them brainlist and ... give valid answer. Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Which of the following analysis should come in place of question mark in the below figure? (a) Inferential ... and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    Which of the following language should be replaced with the question mark in the below figure? (a) Java ... and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    Which of the following function can be replaced with the question mark in the below figure? (a) boxplot ... and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    Which of the following would be more appropriate to be replaced with question mark in the following figure? (a ... and answers pdf, Data Science interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Can we use both swift (.swft) and objective c (.h .m) in same xcode project ?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    Why we use Swift Programming Language?...
asked Nov 30, 2020 in Technology by JackTerrance
0 votes
    What is the use of a double pointer (pointer to pointer) in C?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    You need to combine the first_name and last_name columns in the employees table and display the columns as a combined ... | and || Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    How to change Swift version from 5 to 4 in Xcode?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    How do I see which version of Swift I'm using?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    How to iterate a loop with index and element in Swift?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    How do I call Objective-C code from Swift?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    What is a GUARD statement? What is the benefit of using the GUARD statement in swift?...
asked Nov 30, 2020 in Technology by JackTerrance
...