Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMika Quentin
1,885 PointsThis is not valid input
Hello,
I did everything on my Visual Studio but I still get a "this is not valid input" when I enter "20 5" minutes in the console. I replaced all the int by double but still got this error.
Screenshots : http://1drv.ms/247Rhg6 http://1drv.ms/1LrJwGs
Thank you
4 Answers
Rune Andreas Nielsen
5,354 PointsHi Mika it might be because of your input of "2 05" instead of "205". If there is a space between the numbers, it won't allow you to parse it to either double or int.
// Works fine
string s = "205";
double d = double.Parse(s);
// Throws an error
s = "2 05";
d = double.Parse(s);
Mika Quentin
1,885 PointsActually I wrote 20.5 like in the course. After your post I tried "," and it worked. Is it because my keyboard is a french one ? This is weird.
Thanks for your help !
Jim Gilliam
487 PointsI think it's the space. I've haven't learned yet if spaces are parsed with C#, but Rune (above) says no.
Christopher Debove
Courses Plus Student 18,373 PointsC# write and understand decimal in the language of the OS... Your culture is surely french or another culture where the decimal character is "," and not "."