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 trialJack Leonard
2,894 PointsWhat is wrong with my Code, It seems to match the videos exactly... but doesn't work
See Below:
Treehouse Code: https://www.dropbox.com/s/varohxsuz3obbua/Screen%20Shot%202015-01-26%20at%2021.25.51.png?dl=0
VS
My Code: https://www.dropbox.com/s/rkpr5l9lyrdxjvo/Screen%20Shot%202015-01-26%20at%2021.25.42.png?dl=0
Spot any difference apart form the obvious differentiation in variable names?
3 Answers
Patrick Cooney
12,216 PointsTreehouse code is using a constant and your code is using a variable. Idk if this is for a code challenge or just your code for the app. Can you give us a little more info? Also, it helps us if in the future you post the code directly in the forum. You can format it by putting three ` marks at the beginning on their own line then again at the end on their own line.
kjvswift93
13,515 PointsYes. I figured it out. You created an immutable array by declaring the array using 'let'. Since this array is immutable, the error occurs when you attempt to change the array by passing the label's String value into this array that cannot be changed. Use var to declare the array as "mutable".
kjvswift93
13,515 PointsLooks like your code is missing a curly brace at the end.
Jack Leonard
2,894 PointsThanks for the advice, But doesn't seem to make a difference, I'll try cross referencing my previous code with the videos again.
Carl Reyes
Courses Plus Student 7,225 PointsCarl Reyes
Courses Plus Student 7,225 PointsI agree with Patrick, the fact that it's a constant and yours is a variable is a real difference. Additionally what about your code isn't working?