1
00:00:00,480 --> 00:00:02,680
Hello and welcome to this lecture.

2
00:00:02,700 --> 00:00:03,520
In this election.

3
00:00:03,540 --> 00:00:05,180
Are we talking to you.

4
00:00:05,190 --> 00:00:09,390
But Constance what are Constance.

5
00:00:09,390 --> 00:00:12,930
Constance are basically just like variables.

6
00:00:13,170 --> 00:00:17,940
So they have a lot of properties that variables have.

7
00:00:18,180 --> 00:00:27,030
One of the key differences between costers and variable is that with a constant their values are meant

8
00:00:27,060 --> 00:00:31,910
to remain fixed so they're meant to remain fixed.

9
00:00:31,920 --> 00:00:35,070
You can also still change them.

10
00:00:35,100 --> 00:00:38,430
That's what a constant variable should be.

11
00:00:38,520 --> 00:00:48,000
That is meant to have variables of values that are fit when you try to change the value of a constant.

12
00:00:48,000 --> 00:00:56,450
You get a warning from Ruby ghribi would tell you that this value you're trying to change is a constant.

13
00:00:56,460 --> 00:01:05,730
It should tell you that it has already initialized a value so it will give you a warning or don't elect

14
00:01:05,730 --> 00:01:07,630
to change it.

15
00:01:07,830 --> 00:01:11,700
You define constans just like you would variables.

16
00:01:11,700 --> 00:01:18,400
The only difference is that the first letter has to be an upper case.

17
00:01:18,450 --> 00:01:26,910
For example you can have a constant called sitting and the value is London so you can see the first

18
00:01:26,910 --> 00:01:30,620
letter is uppercase.

19
00:01:31,090 --> 00:01:34,400
Alright let's create a constant variable.

20
00:01:34,410 --> 00:01:37,350
I've got my interactive Ruby open.

21
00:01:37,350 --> 00:01:45,900
If you are on a Mac or lennix just type in ah be in to your terminal or shell and that should give you

22
00:01:45,960 --> 00:01:47,330
access to this.

23
00:01:47,520 --> 00:01:54,380
If you are on a Windows computer interactive Ruby can be accessed by your ruby Ford out you go to all

24
00:01:54,390 --> 00:02:01,110
programs and click on the road before that you got the icon for interactive Ruby.

25
00:02:01,810 --> 00:02:07,350
So I'm going to create a constant called C T.

26
00:02:08,190 --> 00:02:12,580
I just come here and type in the word city.

27
00:02:12,590 --> 00:02:16,030
Make sure the first letter is uppercase.

28
00:02:16,910 --> 00:02:23,050
I'm going to set the value to London.

29
00:02:27,670 --> 00:02:43,420
So if I do a put that put Furdo pause followed by the word City he should output London saw Let's try

30
00:02:43,450 --> 00:02:45,450
and change that value.

31
00:02:45,820 --> 00:02:48,310
So I'd type in city

32
00:02:51,880 --> 00:02:54,090
and set a new value.

33
00:02:55,850 --> 00:02:57,800
So say

34
00:02:59,960 --> 00:03:15,520
let's walk contrition by saying okay let's say I'd type in Orlando or London bombing regis's space.

35
00:03:19,700 --> 00:03:25,490
First let out capital or land.

36
00:03:26,120 --> 00:03:28,730
So watch what happens when I press enter.

37
00:03:28,730 --> 00:03:37,000
As you get a warning from Ruby Sears telling me that already initialise constant city have already initialized

38
00:03:37,040 --> 00:03:38,080
in value.

39
00:03:38,340 --> 00:03:45,610
So warning me that the previous definition of city was here so is telling me that he will change it.

40
00:03:45,680 --> 00:03:52,550
But this constant already has a value of core constants and not meant to have given his changed.

41
00:03:53,000 --> 00:04:02,160
So now if I time paim Puts city I should now get the value of Orlando he see.

42
00:04:02,260 --> 00:04:03,150
Change changes it.

43
00:04:03,160 --> 00:04:06,030
It gives you a warning before it does that.

44
00:04:06,050 --> 00:04:13,150
So that's how constants work solicit for this lecture on Constance.

45
00:04:13,160 --> 00:04:14,460
Thanks for watching.
