C
C#2mo ago
Pan

Warning issues that i doesnt know what's the problem

Did someone know what is the warning want to tell me? i'm confused. also this project made for fun only. Thank YOU!
No description
3 Replies
Angius
Angius2mo ago
Console.ReadLine() can return null in rare cases Just use a fallback
string myLove = Console.ReadLine() ?? "";
string myLove = Console.ReadLine() ?? "";
for example Also, no need to declare variables before assignment Just do both at the same time
Pan
Pan2mo ago
I know but I like that way because it's comfortable to see can u explain what ' ?? " "; ' do?
SpReeD
SpReeD2mo ago
?? and ??= operators - null-coalescing operators - C#
The ?? and ??= operators are the C# null-coalescing operators. They return the value of the left-hand operand if it isn't null. Otherwise, they return the value of the right-hand operand