private int scanner = Convert.ToInt32(Console.ReadLine());
public void Play()
{
while (true)
{
if (scanner > theNumber)
{
Console.WriteLine("your number is too big");
} else
if (scanner < theNumber)
{
Console.WriteLine("your number is too big");
} else
{
Console.WriteLine("you got it");
break;
}
}
}
this is a simple game where I need to iterate thr same number through the set of if
statements. in Java they use
int x;
x = scn.nextInt();
What can I use in C#? There is no scanner.
C# equivalent to Java's scn.nextInt( ) this post doesn't explain how to make a scanner in C#. It only explains how to parse user's input so that make it Integer only