28 Replies
Console.ReadLine()
returns string?
not string
what?
What I said
i dont understand
The method returns a square peg
You're trying to squeeze it through a round hole
how do i fix this?
Two ways
or
oh
never seen this before lol
a ?? b
means "use a
, unless it's null
, in that case use b
"oh ok
does user input work with the debug console in VSCode
Why wouldn't it?
still didnt work :/
What didn't work?
The first prompt comes up
i enter a name then nothing comes up afterwards
Odd
What happens when you run it with
dotnet run
?yeah
...how do i dot that? lol
Open the console
Type
dotnet run
Press enterok
In VSCode you can open it with
Ctrl
+~
that shortcut doesnt work
For context,
string?
means that it's either a string or null. Console.ReadLine()
can in very rare circumstances return null, which is why it returns a string?
.nvm it works
If stdin is closed or eof then it returns null
oh ok
i ran dotnet run in the terminal and it worked
my debug console in VSCode cant take user input... weird
I don't know what key is in Windows, but if you press ctrl+d on macOS or Linux it will cause eof on stdin
You have to set the
console
in your .vscode/launch.json
file to integratedTerminal
. The default console doesn't allow input for some odd reason.oh
welp thanks for everything