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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Steven Zhang](https://secure.gravatar.com/avatar/ba8f188f3407972253177d6d3e00823b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Steven Zhang
310 PointsConstant variables
what is the difference between constant and normal variables, and how does a constant work and why use it in the first place. 1.)difference 2.)how does it work 3.)purpose
1 Answer
![Josh Keenan](https://secure.gravatar.com/avatar/d0419723c8add3c25619f65ab04909c9?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Josh Keenan
19,662 PointsA constant and variable are two different things. A variable you know, it stores a value and can be changed and updated; a constant is a value that should not change.
Both can be used in almost the exact same ways with the only constraint of never being able to change a constant, so you can use it for things you know won't be changing anywhere during your program, that you will still need to use
Nancy Melucci
Courses Plus Student 36,045 PointsNancy Melucci
Courses Plus Student 36,045 PointsI get your meaning but "constant" and "variable" are actually different from each other. A constant is a value you set during your program that cannot be manipulated by the functions and processes in it, but can be used by it. I suppose it's a "variable" because you may set it at the start, but unlike a true variable, it should not be changed by the program's activities. An example would be a tax rate in a simple program to calculate a tax bill. You can set two or three "constant variables" or I would call them "constants" - one for the bottom tier (lorate = .15), one for the middile (midrate = .23) and one for the high earners (hirate = .29) and then your decision structure would determine which one should be applied. The three constants will not change and your if/elif/else will apply them to the gross earnings of the user of the program. I hope that makes sense. The tax bill would be a true variable, and its final value would be determined by the gross pay times the selected tax rate.