Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,650 --> 00:00:08,960
Let's talk about arguments versus parameters which is one of our key terms that we use when describing
2
00:00:08,990 --> 00:00:10,500
functions.
3
00:00:10,520 --> 00:00:11,490
Let's see what they mean.
4
00:00:12,520 --> 00:00:17,020
You see right now are say Hello Function is pretty generic.
5
00:00:17,020 --> 00:00:17,860
Very simple right.
6
00:00:17,860 --> 00:00:19,690
We're just while printing.
7
00:00:19,750 --> 00:00:21,140
Hello.
8
00:00:21,210 --> 00:00:29,520
It's kind of useful but not really the power of functions beyond just being able to call this multiple
9
00:00:29,520 --> 00:00:38,190
times because it only lives in one location in memory is this ability for us to make it dynamic for
10
00:00:38,190 --> 00:00:40,250
example in these brackets.
11
00:00:40,380 --> 00:00:43,370
I can give it what we call parameters.
12
00:00:43,560 --> 00:00:47,430
So in here we give it parameters
13
00:00:50,340 --> 00:00:51,840
inside of the bracket.
14
00:00:51,840 --> 00:00:59,050
So for example I can give it name which is a variable that I just made up I can call whatever I want
15
00:00:59,320 --> 00:01:04,640
and I can leave it like that or I can keep giving it parameters as many as I want I can keep adding
16
00:01:04,640 --> 00:01:07,810
a hundred if I wanted to so.
17
00:01:07,870 --> 00:01:15,720
In this case let's just say this is an emerging so these are two variables or parameters that I've created
18
00:01:16,410 --> 00:01:23,090
and this Say Hello Function is able to receive these two parameters.
19
00:01:23,210 --> 00:01:24,260
What does that mean.
20
00:01:24,260 --> 00:01:28,870
It means that we're able to use these variables inside of this function.
21
00:01:29,000 --> 00:01:39,930
For example I can create this as an F string and say hello and add the name.
22
00:01:40,100 --> 00:01:43,940
And then finally add the emoji.
23
00:01:43,940 --> 00:01:49,920
And because I have these parameters I can use them as variables inside of this code block.
24
00:01:50,000 --> 00:02:00,470
Now these parameters allow us to give the function when we call it what we call arguments.
25
00:02:00,470 --> 00:02:05,720
And by the way the confusion between parameters and arguments people usually say one when they mean
26
00:02:05,720 --> 00:02:06,830
the other.
27
00:02:06,830 --> 00:02:09,980
It's a little tricky so hang in there.
28
00:02:09,980 --> 00:02:17,580
Arguments are used as the actual values we provide to a function.
29
00:02:17,810 --> 00:02:21,100
So now and say hello I can give it a name.
30
00:02:21,140 --> 00:02:27,050
In my case let's just say hi to myself and then I can give it an emotion.
31
00:02:27,350 --> 00:02:34,760
And you see how my editor is giving me the hint that I should give it an emoji because while I defined
32
00:02:34,760 --> 00:02:37,830
it here again something that editors help us do.
33
00:02:38,120 --> 00:02:41,330
So let's just give it just a smiley face with the tongue out.
34
00:02:41,420 --> 00:02:50,600
Now these are arguments these are the actual value we provide to the function and the name of the variables
35
00:02:50,600 --> 00:02:54,020
that we use that we receive are called parameters.
36
00:02:54,020 --> 00:03:01,220
So parameters are used when we define the function and arguments are used when we call the function
37
00:03:02,330 --> 00:03:11,450
defined and call and by the way some people also like saying call or invoking the function or invoke
38
00:03:11,630 --> 00:03:12,140
the function.
39
00:03:12,590 --> 00:03:15,380
So if you ever hear those words you know what they mean.
40
00:03:16,790 --> 00:03:27,610
So if I run this I get Hello Andre with that smiley face and this is when functions get really powerful
41
00:03:28,150 --> 00:03:34,060
because we're able to not just make generic functions that always do the same thing but we can create
42
00:03:34,100 --> 00:03:43,960
a functions that do things based on what parameters we give it or what arguments we call it with so
43
00:03:43,960 --> 00:03:54,130
that now I can use these say Hello Function to say hello to my friend Dan and also my friend Emily.
44
00:03:54,270 --> 00:04:02,090
And if I click Run we've made our function more extensible we can use it in multiple places.
45
00:04:02,220 --> 00:04:08,010
And if we're designing a game well we've just use this to greet our users.
46
00:04:08,010 --> 00:04:16,130
And based on the user name I can use the same function over and over again we're keeping our code dry
47
00:04:16,220 --> 00:04:18,660
and clean by doing something like this.
48
00:04:18,740 --> 00:04:21,840
How cool is that.
49
00:04:21,840 --> 00:04:24,570
All right let's take a break and I'll see you in the next video.
4997
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.