Hello and welcome to this lecture.
In this election.
Are we talking to you.
But Constance what are Constance.
Constance are basically just like variables.
So they have a lot of properties that variables have.
One of the key differences between costers and variable is that with a constant their values are meant
to remain fixed so they're meant to remain fixed.
You can also still change them.
That's what a constant variable should be.
That is meant to have variables of values that are fit when you try to change the value of a constant.
You get a warning from Ruby ghribi would tell you that this value you're trying to change is a constant.
It should tell you that it has already initialized a value so it will give you a warning or don't elect
to change it.
You define constans just like you would variables.
The only difference is that the first letter has to be an upper case.
For example you can have a constant called sitting and the value is London so you can see the first
letter is uppercase.
Alright let's create a constant variable.
I've got my interactive Ruby open.
If you are on a Mac or lennix just type in ah be in to your terminal or shell and that should give you
access to this.
If you are on a Windows computer interactive Ruby can be accessed by your ruby Ford out you go to all
programs and click on the road before that you got the icon for interactive Ruby.
So I'm going to create a constant called C T.
I just come here and type in the word city.
Make sure the first letter is uppercase.
I'm going to set the value to London.
So if I do a put that put Furdo pause followed by the word City he should output London saw Let's try
and change that value.
So I'd type in city
and set a new value.
So say
let's walk contrition by saying okay let's say I'd type in Orlando or London bombing regis's space.
First let out capital or land.
So watch what happens when I press enter.
As you get a warning from Ruby Sears telling me that already initialise constant city have already initialized
in value.
So warning me that the previous definition of city was here so is telling me that he will change it.
But this constant already has a value of core constants and not meant to have given his changed.
So now if I time paim Puts city I should now get the value of Orlando he see.
Change changes it.
It gives you a warning before it does that.
So that's how constants work solicit for this lecture on Constance.
Thanks for watching.