[MUSIC] All right, let's make this function a little bit easier to read for the caller using internal and external parameter names. So let's go back and see what our function looked like before and how we're going to improve it. We have our function here called showInfo. The first argument is called p. When we start calling the argument, I'll just do a little bit of typing here, showInfo, notice that we get some placeholders here for our arguments to help us know what we're expected to pass into that function. But it doesn't really help me, unless I created the function, to have a function called p, because I don't know p stands for. Right? Unless I am able to ask that developer or there's some documentation for that function or something. But we can avoid having to do a lot of work there perhaps by making our function parameters better named, so let's do that. And we don't want to create a lot more work for ourselves when we do this. Luckily, we can use internal and external variable names for the arguments of a function. And not really have to change anything inside of the function and make it more legible for callers of the function. So here is the same exact function. I literally just took the code from inside of the curly braces and pasted it into this new function. The only thing that is different is the function's signature, this part up here before the curly braces. So, function showInfo of planet, now you'll see this extra word here, planet. That's the external argument name. And I kept here the internal argument name of p. So that's why I didn't have to everywhere p occurred inside of my function body, I didn't have to replace it with the word planet. So that's pretty convenient for us. Now when I come down here, after that function is declared, so after its curly braces somewhere, I can call that. And you'll notice now that I'm seeing showInfoOfPlanet. And the first argument's name is planet. So it's very obvious to me what I need to provide this function with. Okay, notice that when I don't have an explicit external argument name, here I just have one argument name, right, p. So it'll be used both internally and externally of this function. When I only have one argument name like that, I do not need to provide the name of the first argument when I'm calling it. But when I do have an external and internal argument name as I do in this example here, then the name of the first argument is required. Okay, so now if I say showInfoOfPlanet Venus, show number of moons equals true, and show moon names also true, I should be able to see that information down here. Here's the information you asked for about planet Venus. No information is available for the number of moons, and no information is available for the names of moons of planet Venus, which of course has no moons. But it proves that our function continue to work, and I just wanted to show the different case of that function working. All right, now let's look at how can we set some default values for our function parameters. This can be also pretty useful. This is essentially the same function that we've been working with, it just now has default values for the parameters. So I just called it showDefaultInfoOfPlanet because our functions have to have a unique name within their enclosing scope. So, in this case, the closing scope of my function is the whole playground. When you're working with applications, it's more likely to be something like, a struct or a class will be the enclosing scope, so keep in mind your function names should be unique. So this one lets me know it's the example with default values for the parameters. So I have showDefaultInfoOfPlanet, some planet and internally we refer to that as p. And showsNumberOfMoons is still a rule. But notice that we set it equal to true inside of the function signature. So the default value for this argument will be true. Same thing with here shows moon names is also set to true. So the rest of this inside of this function is exactly the same. I didn't change it at all. But when we call it, notice that there's some differences here now. We're calling ShowDefaultInfoOfPlanet, the function we just created, but notice here I'm only passing one argument, the planet. What happened to showsNumberOfMoons and showsNameOfMoons? Well those have default values, so if I'm okay with the default values when I call it, then I don't have to list out those arguments in the calling line of code. I can set just one or one of the parameters with the default value as I do in the next line here, show default info of planet, the planet Mars. And they only provided one other argument here, right, showsNumberOfMoons is false. I don't want to see the number. Here I've set one to true, which just happens to be the default value and when to false which is the opposite of the default value. In this case, since it's a bool. But I can set both parameters, if I want to. And this is the order that the parameters appear in our function. I'm also not limited there. Notice up here, I only pass in shows number of moons and down here, our only pass in shows moon names. So, it's very flexible. And if we look at our console, which I'll make much bigger, so that we can see the differences. And just know that our code is working. Show default info of planet Mars. So, that would be this first one here was ShowDefaultInfoOfPlanet, so we can know what we're looking at in the console. Here's the information you asked for, no information for the moons of planet Mars, right? showInfoOfPlanet Mars do show me the number but don't show me the moon names. So that's the second one here. It doesn't tell us anything about the number of moons, right, compared to this first one. But it does tell me information about the names of Mars. There just don't happen to be any. And on this second line here, this behaves as we would expect from a previous example. The last line here shows when moon names equals false, showsNumberOfMoons the default is true. So we should expect here, no information available for the number of moons. But it doesn't tell us anything about those names since we set that to false. [MUSIC]