Let's talk about arguments versus parameters, which is one of our key terms that we use when describing
functions.
Let's see what they mean.
You see, right now, our say hello function is pretty generic.
Very simple, right?
We're just well printing.
Hello.
It's kind of useful, but not really.
The power of functions beyond just being able to call this multiple times because it only lives in one
location in memory is this ability for us to make it dynamic?
For example, in these brackets I can give it what we call parameters.
So in here we give it parameters.
Inside of the bracket.
So, for example, I can give it name.
Which is a variable that I just made up.
I can call whatever I want and I can leave it like that, or I can keep giving it to parameters as many
as I want.
I can keep adding 100 if I want it to.
So in this case, let's just say this is an emoji.
So these are two variables or parameters that I've created.
And this say hello function is able to receive.
These two parameters.
What does that mean?
It means that we're able to use these variables inside of this function.
For example, I can create this as an F string and say hello.
And add.
The name.
And then finally add the emoji.
And because I have these parameters, I can use them as variables inside of this code block.
Now, these parameters allow us to give the function when we call it what we call arguments.
And by the way, the confusion between parameters and arguments.
People usually say one when they mean the other.
It's a little tricky, so hang in there.
Arguments are used as the actual values we provide to a function.
So now in say hello.
I can give it a name.
In my case, let's just say hi to myself and then I can give it an emoji.
And you see how my editor is giving me the hint that I should give it an emoji because well, I defined
it here again, something that editors help us do.
So let's just give it just a smiley face with the tongue out.
Now, these are arguments.
These are the actual value we provide to the function and the name of the variables that we use that
we receive are called parameters.
So parameters are used when we define the function and arguments are used when we call the function.
Define and call.
And by the way, some people also like saying call or invoking the function or invoke the function.
So if you ever hear those words, you know what they mean.
So if I run this.
I get.
Hello, Andre.
With that smiley face.
And this is a when functions get really powerful because we're able to not just make generic functions
that always do the same thing, but we can create functions that do things based on what parameters
we give it.
Or what arguments we call it with.
So that now I can use the say hello function to say hello to my friend Dan and also my friend Emily.
And if I click Run, we've made our function more extensible.
We can use it in multiple places.
And if we're designing a game, well, we've just used this to greet our users.
And based on the user name, I can use the same function over and over.
Again.
We're keeping our code dry and clean by doing something like this.
How cool is that?
All right.
Let's take a break and I'll see you in the next video.