Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,060 --> 00:00:05,890
In the last section, we wrote out our first tiny little dart program, this is essentially a hello
2
00:00:05,890 --> 00:00:10,420
world program and I know hello worlds are very boring and you don't really like to see them inside of
3
00:00:10,420 --> 00:00:10,960
courses.
4
00:00:11,230 --> 00:00:16,149
But in this case, we can actually learn a lot about the programming language by tearing apart this
5
00:00:16,149 --> 00:00:18,270
snippet of code line by line.
6
00:00:18,580 --> 00:00:21,270
And so that's exactly what we're going to do in this section.
7
00:00:21,280 --> 00:00:25,630
We're going to start with this first line of code right here, and we're going to tear this thing apart
8
00:00:25,780 --> 00:00:30,150
line by line or piece by piece and get a better idea of what's going on behind the scenes.
9
00:00:30,430 --> 00:00:31,480
So let's get to it.
10
00:00:32,500 --> 00:00:37,840
In this diagram right here, I took that line and put it into a series of different blue boxes, so
11
00:00:37,840 --> 00:00:42,220
we're going to talk about every little chunk inside of here, starting off with the word vare on the
12
00:00:42,220 --> 00:00:46,390
far left hand side, the word vare declares a new variable.
13
00:00:46,900 --> 00:00:51,380
This is one way of many in which we can declare a new variable inside of Dart.
14
00:00:51,400 --> 00:00:55,960
And we'll very shortly see some of the other ways in which we can declare a variable rate.
15
00:00:55,960 --> 00:00:58,230
After that, we put down the variables name.
16
00:00:58,510 --> 00:01:04,030
In this case, the name of the variable was simply name, just like many other programming languages.
17
00:01:04,030 --> 00:01:08,290
We can then later on reference this variable by simply writing out the word name.
18
00:01:09,460 --> 00:01:14,560
We then placed our equal sign and then on the right hand side that we had a reference to the function,
19
00:01:14,710 --> 00:01:21,910
my name, the set of parentheses after my name invokes that function or it runs it returns a value and
20
00:01:21,910 --> 00:01:24,820
then that value gets assigned to the variable name right here.
21
00:01:25,570 --> 00:01:29,590
One thing I want to point out in particular is the semicolon at the end of this line.
22
00:01:29,770 --> 00:01:32,590
So Dart requires us to make use of semicolons.
23
00:01:32,900 --> 00:01:35,920
They're not optional as they are inside of JavaScript.
24
00:01:36,870 --> 00:01:41,010
Now, the last thing I want to mention about this line of code right here is that there's actually two
25
00:01:41,010 --> 00:01:45,210
separate things occurring on the left hand side of the equals sign.
26
00:01:45,210 --> 00:01:47,100
We have VARE and then name.
27
00:01:48,050 --> 00:01:54,470
These two words right here form a step that we refer to as variable declaration, variable declaration
28
00:01:54,470 --> 00:02:00,350
is the process of actually creating this variable and telling darte, hey, here's a new variable and
29
00:02:00,350 --> 00:02:01,160
here's its name.
30
00:02:02,240 --> 00:02:08,900
Then with the equal sign and the call to the mining function, we have a second step referred to as
31
00:02:08,900 --> 00:02:16,250
variable initialization, initialization is the process of assigning a value to a variable that has
32
00:02:16,250 --> 00:02:16,970
been declared.
33
00:02:17,630 --> 00:02:19,250
So, again, two separate steps here.
34
00:02:19,280 --> 00:02:22,980
The first one is variable declaration and the second is initialization.
35
00:02:23,600 --> 00:02:28,520
This might seem like a very small distinction to make, but later on, as we start to go deeper into
36
00:02:28,520 --> 00:02:34,010
darte, the difference between declaration and initialization is going to start to get very important.
37
00:02:34,830 --> 00:02:38,850
OK, so we just took apart one line of code, let's continue in the next section and we're going to
38
00:02:38,850 --> 00:02:41,400
continue looking at this little snippet right here.
39
00:02:41,430 --> 00:02:43,550
So quick break and I'll see you in just a moment.
4179
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.