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 trialAnonymous Person
5,297 PointsSwift Terminology
I don't understand what Pasan means when he uses the phrase "hard code." What does it mean to hard code?
Anonymous Person
5,297 PointsThank You, I understand it now
Tyler Andal
8,383 PointsTyler Andal
8,383 PointsDefinition I pulled from google: fix (data or parameters) in a program in such a way that they cannot be altered without modifying the program.
Here is an example to elaborate on that definition some more.
On a login screen you might have a label which is hard coded to say "Username:". This makes sense since it probably won't be something that needs to be modified.
Now, next to your username you have a text box which accepts input. You would want the text value you store in this box to be a variable and not a constant, or something that is hard coded. If the name stored here was hard coded only names in the constant could exist, and the only way to update it would be to go in code and update the constant.
I hope this is helpful information.