C
Join ServerC#
help
❔ help with code
SSmolLime1172/11/2023
what is the problem in this code?

Pphaseshift2/11/2023
Don't know, what is the problem?
SSmolLime1172/11/2023
i dont understand why it is highlighting Console.ReadLine(); yellow
Tthinker2272/11/2023
the only thing there is a warning
Tthinker2272/11/2023
it's not an error
Pphaseshift2/11/2023
It tells you when you mouse over it
SSmolLime1172/11/2023
yeah but even when there is nothing there is says there is a problem

Tthinker2272/11/2023
that's just vscode being vscode
Tthinker2272/11/2023
restart vsc and it'll probably be fixed
SSmolLime1172/11/2023
oh
Tthinker2272/11/2023
but anyway, the warning itself says that the result of
Console.ReadLine()
may be nullTthinker2272/11/2023
You can solve this either by doing
Console.ReadLine() ?? ""
or doing Console.ReadLine()!
Tthinker2272/11/2023
The first of which is kinda the most preferable
SSmolLime1172/11/2023
oh ok that makes sense thanks
Tthinker2272/11/2023
a ?? b
essentially means "if a is not null then return a from the expression, otherwise return b"AAccord2/12/2023
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.