Welcome to the Treehouse Community
Looking to learn something new?
I'm having difficulty understanding variable and constants
the video is too fasts
// Enter your code below
A variable is a label that can contain a value that you want to use again and again in your programs.
For example, instead of doing the following:
print("Hi, my name is Luke") print ("I am called Luke")
You can do this:
var name = Luke print ("Hi, my name is \(name)") print("I am called \(name)")
This way, you only have to change the value that is assigned to 'name' rather than changing the print statements output more than once.
The difference between variables and constants is pretty simple. One can be changed as it's a 'variable' value and the other is a 'constant' value so it cannot change and always remains the same.
I hope that this helped you out! If you need any more help then don't hesitate to ask.