In the previous lecture, we learned how to implement the function headers, for the four different kinds of functions. In this lecture, will complete our function definitions, by implementing the bodies, for those four different kinds of functions. And we might as well call those functions as well. Okay, let's start implementing our function bodies and calling those functions from our main function. We'll start with PrintMessage(), and we know how to do this. And of course, I can add a new line at the end as well. Now that we've implemented the body of the function, let's go call it from the main function. And if I build, I get an error message that says, identifier or not found for PrintMessage();. Here's the problem. The compiler starts at the very top of the file, and works its way down, and when it gets here, it has no idea what PrintMessages();. Because the function definition for PrintMessage();, is down here. We could fix this by doing this. And now we can compile our code, and we can run our code and it even prints "Hi, noob" before us. The problem is, that a lot of times we don't want all our function definitions before a main function, we would prefer, that they appear after the main function. Because the main function captures everything our program is doing, and most people would prefer to see that up top at the very beginning or near the beginning of the file, rather than at the very end. So we'd like to structure our code this way, but still have it compile and run. The way we can do this, is we can provide what's called a function declaration, or a function prototype is perhaps more commonly used as the terminology to tell the compiler there will be a function later, with a particular header. Because the header contains all the information the compiler needs to know to be able to call the function. It doesn't need to know the body yet, but it does need to know about the header. This is really straightforward. We can just take our function header, and go above main, and put the function header with a semi colon. And this is a function prototype for that function. And I'll comment this, so the compiler knows there's a function with this header that will appear somewhere in this file, and then it knows how to handle this call to the function. So I'll write it, and as you can see, that works fine. So we know we're going to need prototypes for all of these functions, so let's just do that now, making sure I didn't break anything, so I'll build, a build file. So let's call the next function, the printprovidedmessage function. And I'll say, ("Hello, World") instead. Now, I need to implement the body of this function, so I'll grab some stuff. And we'll print the message, and we'll follow it with a new line. And when I run the code, you can see I get the PrintMessage function results in the PrintProvidedMessage function result. Before we move on to the other two functions, I want to point out that we don't actually have to have two different names for these two functions. I can call this function, print message as well. I'm going to rename it. I right clicked, and I picked rename, and I'm going to say, I want to call this PrintMessage(). And I'll say go ahead and do that. And you can see it actually renamed it up here in the function prototypes as well, because it knows this function prototype goes with that complete function definition. The reason we can do this, is because these two function headers are different in the parameters that we're providing. And we've talked about in previous courses in the specialization, that we can overload functions, that we can have functions with the same name. And the compiler can figure out which function to call, based on the parameters that we provide. So I'm going to run this again. And you can see we get the same result, even though we have these functions with the same names. It's probably more common to overload functions that do the same sort of job, like printing a message with the same function name in different parameter lists, instead of having unique function names for all of them. That's why you'll regularly see overloaded functions, both in the Unreal Engine, In and C++ in general, because that's a more common way to approach this issue. And the compiler can just figure it out based on the arguments that are being provided when you call the function, even though the function is the same name. Okay, on to GetRandomNumber();. GetRandomNumber() is supposed to return a number between 0 and the maximum integer -1. Now, you probably didn't notice, but I've included the''Random.h', and the random.cpp that we use for our dye class here in this project, so that I can just call here, and random each, I can call Next. Now, Next returns a number between 0 and MaxValue -1. So that's essentially what we want here. So we can just say, return Random.; and we immediately get red squiggles because I need to pound include the 'Random.h'. And now I can call the Next function which remember is a static function, so I call it using ;;. And I need to provide an argument for that exclusive upper bound of MaxValue. And as luck would have it, the maximum value for an integer, in C++, is INT_MAX;;. That's a constant that's built into C++. Okay, so now we come back here, and we'll just output the result of calling GetRandomNumber. And when I run, you can see I got some RandomNumber, pretty big RandomNumber. I'll run again and I got a different RandomNumber and so on. Let's implement the body of our last function though I'm going to overload the GetRandomNumber() function, just like we overloaded the PrintMessage(); function. And this time we'll do this, except instead of using (INT_MAX); we'll use the (MAXVALUE); parameter that was passed in. And I'll call the function. Except I'll call the other version of the function where I pass in some (MAXVALUE); like (6). So when I run the code, as you can see everything is working fine. There are a couple of things I'd like to actually do, first, for functions that return the value, I'm going to show you that, of course, I can put the result into a variable as well as just printing it out to the street. So I'll grab this, and I'll put it here. There's nothing visible to see here when I run it, It looks just like it did before. But, I wanted to show you that, many times when we call a function that returns a value, we are going to use that value. So we're either going to immediately use that value here, or we're going to save it because we want to do something with it. It's also possible to just call this function that returns a value, and throw away the value that it returned. So this compiles fine and runs fine. It's far more common to use the returned value formal function immediately. Like here, are saved into a variable as I showed you moments ago, but it is possible to do this as well. Those use cases are less common, but you might want to do it if you want to sort of crank through the next few rain numbers or something before you use the next one, or some other reason. But almost always, you're using it immediately or saving it in a variable so you can do something with it. Okay, the other thing that I want to show you, just as when we used one constructor from another, when we built our dye class, we can of course call one function from another, just as we call one constructor from another in that dye class. So this PrintMessage() could in fact do this, it could say PrintMessage(), ("Hi, noob");. And so inside this function, we call the other function that actually prints the message. Let me show you that that works properly. And as you can see it does. So in this particular situation, I'd like this code better than the code that I just replaced. It's your call, but you should definitely understand that, we can call functions from functions. And we've been doing that all along, right? Main() is a function and we're calling a function from a function, so of course we can do it. I like this form better than the previous one, where I did standard see out here. Similarly, I prefer here GetRandomNumber. Just calling this function with (INT_MAX);. There is a cost, there's one extra function call which takes time, and it takes a little bit of extra memory as well on something called the call stack, so you get to decide how you want to do it, but this is my personal preference. And of course I made a mistake when I did that, because I'm no longer returning a value from that first. GetRandomNumber() function, because what I really want to do is return the result of calling this GetRandomNumber with (INT_MAX);. And when we run again, as you can see it's working properly. To recap In this lecture, you learned how to implement the function bodies for the four different kinds of functions. You learned how to use function prototypes, and you learned that we can use or ignore the ReturnValue for functions that return a value