0
[SOLVED] Why does C# no accept user input in Playground?
So lately I've noticed that C# does not show a pop-up window for input, when using Console.ReadLine (). Anyone know why that is?
26 Réponses
+ 5
~ swim ~
don't work:
string input = Console.ReadLine ();
works:
string input = Console.ReadLine();
+ 5
Mike Mortensen It's not working because there is space between ReadLine and parenthesis ().
It should be like
Console.ReadLine()
+ 4
.Mike Mortensen I don't know why exception not came but that was the problem.
+ 4
Mike Mortensen Denise Roßberg It maybe Sololearn issue because when I am printing value using this below syntax it's working fine.
Console.WriteLine (input);
+ 2
Denise Roßberg, 🅰🅹 - Sʀ. Sᴏғᴛᴡᴀʀᴇ Eɴɢɪɴᴇᴇʀ: In the couch challenged the input goes through with bo problems.
It's only that the box not popping up if there's a space inbetween 🤔
+ 2
~ swim ~ Thanks for clarification.
+ 1
Well, there's no code, as it's not really the code that's wrong. But let me write some code and get back to you :-)
+ 1
Mike Mortensen string input = Console.ReadLine(); works
remove the space between ReadLine and ()
+ 1
Have a look at the comment I posted right before yours, ~ swim ~ :-)
The code is almost identical. 🤔
So Maybe it's my app that's bugged.
I've coded in C# for 8 years. So I'm pretty sure I'm not coding it wrong 😅🤷♀️
+ 1
Thanks Denise Roßberg !
I wonder why that is? 😅
+ 1
Mike Mortensen me too.
~ swim ~ Do you know if this is a real syntax error or if it is a sololearn issue?
+ 1
Mike Mortensen
In java it is possible:
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int n = scan.nextInt ();
System.out.println (n);
}
}
Maybe only sololearn knows why it is not possible in C# ;)
0
Please share a code so that we can examine it.
0
Here you go, Denise Roßberg :-)
https://code.sololearn.com/c2LuQ1isCPU4/?ref=app
0
That is odd to me, as it's not really a syntax error, 🅰🅹 - Sʀ. Sᴏғᴛᴡᴀʀᴇ Eɴɢɪɴᴇᴇʀ 🤔
0
It's a Sololearn issue, Denise Roßberg .
I'm coding in Visual Studio every day.
It's a formatting habit of mine and syntax errors would be flagged bybthe compiler:-)
0
How many ways to take input in java
0
Вы можете преобразовать строку в целое число, используя Convert.Функция ToInt32()
int intTemp =...
0
Никита Гуляев What? 🤔
0
Sorry.. I think you are Russian