Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,090 --> 00:00:01,380
What is going on, guys?
2
00:00:01,380 --> 00:00:08,130
And welcome back to another section where we are going to talk about a new topic called ERASE.
3
00:00:08,790 --> 00:00:11,670
So what is in array in this video?
4
00:00:11,750 --> 00:00:18,690
We are going to talk about erase and explain why it is an array, why you should consider using it and
5
00:00:18,690 --> 00:00:19,310
so on.
6
00:00:19,620 --> 00:00:24,920
So up until now, you've seen how single variables were created and used.
7
00:00:25,170 --> 00:00:31,560
And by seeing single variables say simply mean that you've been using, for example, one variable of
8
00:00:31,560 --> 00:00:32,530
some type rate.
9
00:00:32,880 --> 00:00:39,950
For example, you could have created a variable with the name age and then assign it with some value.
10
00:00:39,960 --> 00:00:41,280
For example, fifteen.
11
00:00:41,430 --> 00:00:48,570
Or you could have created two other variables, let's say grade one and grade two to hold your grades
12
00:00:48,570 --> 00:00:51,570
and then use them to calculate the average grade.
13
00:00:52,350 --> 00:00:58,050
So we've created a couple of separated boxes or variables, as we also call them.
14
00:00:58,050 --> 00:00:58,380
Right.
15
00:00:58,800 --> 00:01:04,050
With different names to hold different types of data and different data.
16
00:01:04,200 --> 00:01:05,260
And that was awesome.
17
00:01:05,280 --> 00:01:08,130
But we want to go one step further.
18
00:01:08,220 --> 00:01:14,670
We want to learn a new principle which is frequently being used in programming, and that is the array.
19
00:01:14,940 --> 00:01:20,640
But before we do so, I want you to think of a time when you had to write a program to calculate your
20
00:01:20,640 --> 00:01:21,480
average grade.
21
00:01:21,900 --> 00:01:26,640
So we've simply created, let's say, two variables, grade one and grade two.
22
00:01:26,970 --> 00:01:31,100
And we've used that to calculate the average of these two grades.
23
00:01:31,140 --> 00:01:31,430
Okay.
24
00:01:31,770 --> 00:01:38,580
But that was some basic scenario when we only had two grades and thus we had only two variables, grade
25
00:01:38,580 --> 00:01:42,000
one and grade two, which were used to hold the data.
26
00:01:42,450 --> 00:01:48,570
So in this case, the program knows only to calculate the average between these two grades.
27
00:01:48,960 --> 00:01:54,480
And if we would like to upgrade upgrading somewhat our program, maybe just a little bit.
28
00:01:54,870 --> 00:02:00,030
So it will be able to, let's say, calculate the average of three grades van.
29
00:02:00,030 --> 00:02:04,860
In this case, we should simply add a third variable and maybe call it great.
30
00:02:04,950 --> 00:02:05,520
Three.
31
00:02:05,600 --> 00:02:05,970
Right.
32
00:02:06,180 --> 00:02:10,950
And then we can just calculate rate, for example, after we added the third grade.
33
00:02:11,250 --> 00:02:17,850
Then we can just calculate the average between these three variables of these three values.
34
00:02:18,000 --> 00:02:22,350
Just by summing up all of them and dividing by three.
35
00:02:22,800 --> 00:02:23,460
All right.
36
00:02:23,850 --> 00:02:30,570
Now, what will happen if you have 10 or 20 grades that your program needs to store, not only to calculate
37
00:02:30,570 --> 00:02:35,910
the average, but also to store for later processing of these data or something like that?
38
00:02:36,390 --> 00:02:41,900
Will you create 20 different grade variables and call them by names?
39
00:02:41,910 --> 00:02:42,480
I don't know.
40
00:02:42,500 --> 00:02:45,630
Grade one, grade two, grade three and so on.
41
00:02:45,870 --> 00:02:47,610
That's kind of absurd, isn't it?
42
00:02:47,850 --> 00:02:54,930
Your program is going simply to be huge and your code is going to be very hard to maintain.
43
00:02:55,410 --> 00:03:01,710
Not to mention the fact that you may have a lot of bugs because you have missed one or two grades in
44
00:03:01,710 --> 00:03:03,210
your calculations.
45
00:03:03,300 --> 00:03:09,600
So would you like to have a program with hundreds of different variables that just will present your
46
00:03:09,600 --> 00:03:10,140
grades?
47
00:03:10,590 --> 00:03:11,520
I bet you don't.
48
00:03:12,120 --> 00:03:16,530
You would rather have some one collection with all the grades inside of it.
49
00:03:16,710 --> 00:03:20,040
One collection that can be referred to with just one name.
50
00:03:20,070 --> 00:03:25,410
That could be access to get the details regarding each of your grades.
51
00:03:25,560 --> 00:03:28,680
It's just like putting all your grades in one bag.
52
00:03:28,980 --> 00:03:35,790
And instead of spreading these grades randomly in the bag, let's say that we would like to use a special
53
00:03:35,790 --> 00:03:36,750
type of bag.
54
00:03:36,900 --> 00:03:44,370
Some unique bag in which all the grades are going to be arranged in just one straight line.
55
00:03:44,670 --> 00:03:51,360
Now, when all the elements are well organized, we can access any of the grades we have just by using
56
00:03:51,450 --> 00:03:54,180
or referring to this bag.
57
00:03:54,330 --> 00:04:00,510
And let's also say that's the name of the bag will be grades, just like you can see right now on the
58
00:04:00,510 --> 00:04:00,960
screen.
59
00:04:01,380 --> 00:04:09,150
So we know that grades the bag we've defined may contain one, two, five or any other number of elements
60
00:04:09,180 --> 00:04:12,330
or better say any number of grades.
61
00:04:12,510 --> 00:04:16,710
And basically, we need we can access, read and write.
62
00:04:17,200 --> 00:04:21,200
Are any element within these grades array.
63
00:04:21,510 --> 00:04:25,200
So we can take any any grade in this bag.
64
00:04:25,320 --> 00:04:29,070
And simply to see what value it holds.
65
00:04:29,130 --> 00:04:34,590
So we can say that each element in the bag will simply hold a grade.
66
00:04:34,680 --> 00:04:37,200
And how should you access any of these elements?
67
00:04:37,290 --> 00:04:40,140
Well, we will see in the next video.
68
00:04:41,820 --> 00:04:48,630
In one of the next videos here, how it can be accessed, because any of the elements here in the bag
69
00:04:48,630 --> 00:04:57,660
has its own unique index, its own unique specifiers within this well organized bag, well organized
70
00:04:58,060 --> 00:04:58,720
collection.
71
00:04:58,980 --> 00:04:59,800
And just basic.
72
00:04:59,910 --> 00:05:07,530
Jesse Frank, the index in the bag, we will be able to access a particular element and then you can
73
00:05:07,530 --> 00:05:09,460
simply read into it.
74
00:05:09,480 --> 00:05:10,290
Read for me.
75
00:05:10,440 --> 00:05:12,540
Change it or do whatever you like.
76
00:05:12,660 --> 00:05:15,990
So that's also one thing we're going to talk in the next videos.
77
00:05:16,440 --> 00:05:18,930
And basically, to sum everything up.
78
00:05:19,290 --> 00:05:24,600
We first create some unique bag than we can put inside of this unique bag.
79
00:05:24,600 --> 00:05:31,710
Some elements, for example, grades and the elements we put inside this bag are not just scattered
80
00:05:31,710 --> 00:05:39,630
around the area, arranging a street door there where there is a specified specified place, a specified
81
00:05:39,690 --> 00:05:43,590
index for each of the elements in the bag in disarray.
82
00:05:44,250 --> 00:05:48,580
And of course, this unique bag has some size.
83
00:05:48,700 --> 00:05:48,890
Right.
84
00:05:48,900 --> 00:05:52,710
It may has a different type of size each.
85
00:05:52,980 --> 00:05:59,970
There are a lot of different bags out there, which is simply the number of aliments the bag can hold.
86
00:06:00,330 --> 00:06:06,450
So the more elements are given, a given bag can hold, the bigger the bag itself would be.
87
00:06:06,870 --> 00:06:07,200
Right.
88
00:06:07,210 --> 00:06:07,800
You agree?
89
00:06:08,820 --> 00:06:11,490
So we can create an array.
90
00:06:11,670 --> 00:06:14,460
We can put inside the array some elements.
91
00:06:14,460 --> 00:06:19,050
And there are some elements in a well organized manner spread around inside.
92
00:06:19,500 --> 00:06:24,030
And also, we know that there may be different types of bags.
93
00:06:24,930 --> 00:06:33,150
So that's just my analogy to how I see a raise and how I suggest you to look at them basically just
94
00:06:33,150 --> 00:06:35,190
some bag to hold elements.
95
00:06:35,220 --> 00:06:38,970
And you can access any of the elements just by using the index.
96
00:06:39,450 --> 00:06:47,010
You can specify what is the type of the elements that are going to be inside of this collection, inside
97
00:06:47,010 --> 00:06:47,710
of this array.
98
00:06:48,030 --> 00:06:50,760
And also the size of the array may change.
99
00:06:50,790 --> 00:06:54,570
So there are a lot of different bags out there.
100
00:06:55,080 --> 00:07:03,240
And I promise you guys in the next couple of videos where we are going to talk about how it is used
101
00:07:03,240 --> 00:07:09,240
in our programming language, things will become more clear to you and you will understand all these
102
00:07:09,240 --> 00:07:11,040
concepts, all of this analogy.
103
00:07:11,370 --> 00:07:18,150
So just for now, stay focused and let's move on to the last example that I want to talk about in this
104
00:07:18,150 --> 00:07:18,600
video.
105
00:07:18,750 --> 00:07:22,500
So let's see the array concept once again.
106
00:07:22,830 --> 00:07:26,190
So there is an array here is on our array.
107
00:07:26,220 --> 00:07:30,210
Yeah, we can see the bag on the right and in the middle.
108
00:07:30,300 --> 00:07:36,570
Right now, we can see all the content, all the elements within this array, within this bag.
109
00:07:37,110 --> 00:07:43,410
So this array has a specified size which says how many elements on this array may have.
110
00:07:43,410 --> 00:07:46,080
And in this case, we have nine elements.
111
00:07:46,530 --> 00:07:54,870
So the elements within the array are organized in such a way that this order of the elements matters.
112
00:07:54,990 --> 00:07:59,430
And basically you can access any of the elements, just like we can see right now.
113
00:07:59,820 --> 00:08:04,230
And you can change it just by using the index of the element.
114
00:08:04,650 --> 00:08:11,040
So I really hope that this animated introduction of the arrays concept is clear for you.
115
00:08:11,200 --> 00:08:18,000
And in the next video, we are going to take a look at how we can use arrays in our programming language.
116
00:08:18,600 --> 00:08:21,660
So, as always, guys, thank you so much for watching.
117
00:08:21,750 --> 00:08:23,980
And I'll see you in the next video.
11354
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.