Tirth Upadhyay920 Points
why not int instead of string?
we use : string Input = Console.ReadLine();
then we need to convert the string into integer.
why cant we directly use the integer????
Jennifer NordellTreehouse Staff
Because everything coming in from the user from the console is a string. So we have to take what they have put in and change it to an integer. This is not specific to C#. All input from the user (in most languages I know) have what's coming in as strings.
edited for additional note
While you could try to parse the integer from their input when originally assigning to the variable, any incorrect input from the user would cause an unhandled exception and your program would crash. This (imo) would not be the best solution.
Gi Devs12,171 Points
we could in theory do it all in one line but for starting perposes it is better to split it up. I like to experiment a bit and work thing s out on my own and I came up with this
int newInput = System.Int32.Parse(System.Console.ReadLine());