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 trialJakob Tolstrup
1,623 PointsQ5 - Why won't it compite succesfully?
Why won't total =0; compile succesfully? I answered the question correct, as my intution told me it wouldn't, however I don't undertand why.
Best, Jakob
1 Answer
Raffael Dettling
32,999 PointsThe variable total has no type so it cant be assigned to an integer :)
Jakob Tolstrup
1,623 PointsJakob Tolstrup
1,623 PointsSo if it was called string total = "0" or int total = 0 it would compile? :)
Raffael Dettling
32,999 PointsRaffael Dettling
32,999 PointsSure it would compile one other possibility is to declare the variable before and then assign a value later
But remember the variable should have a vale befor using it ^^