Avatar ·

What do two question marks mean in C#? (?? operator)

Hello colleagues! I recently started learning C# and came across a strange construct in someone else's code. It was something like: ```csharp string name = userName ?? "Guest"; ``` I understand that `userName` is a variable and `"Guest"` is a string. But what does this double question mark (`??`) do? Is it some kind of comparison operator? Or a shorthand for `if-else`? I tried searching online but only found general explanations in English that I didn't fully understand. Can you explain in simple words in Russian, preferably with examples? When should this be used? And is there a difference between `??` and the ternary operator `?:`? Thanks in advance! I'm writing a simple console application where I need to get a username, and if it's not specified (null), then display "Guest". Here's my current