Now let's talk about types of functions. Basically, there are two types of functions. The first one is a function that will do something either in the background or will do something where we'll execute a lines of code inside it, but it will not return anything. The other type of functions is a function that would either take a value or just execute something inside it and will return something to us. In that case, we are waiting for this function to return something to us. So we cannot proceed further with the code without the value that we will get from that function.
So previously, we have created this function which will take the value and multiply by two and just print the result in our country. So, this is the first type which will not return anything, it just will execute the code inside it. And either it will continue executing it in the background, or it will just execute it and finish it. The other type of functions is a function that will return something. And I'm going to show you that now, let's create another function called multi ply. by three, three, and inside this function, I'm going to also pass a value and then I'm going to do the same exactly the same here.
And I'm going to just in here I'm going to multiply by three and of course this is B. And instead of just printing the result, I am going to return return this Result return. And this is the key word that I am talking about here, which is return, this return will return the value. So we should wait for this function to return something before we proceed. So here if I execute this function, if I call this function, and I pass for example, to and just save and run, and nothing will of course, nothing will be printed in our console because we just returned this value, we did not print this value in our console. And a good way, a good practice is to store the result.
So, I'm going to create here a VAR and new var, and I'm going to call it anything like result equals to this function which will return the value and outside this function, outside the multiply by three, I'm going to use the console the Long, and I'm gonna pass the result. And I'm going to save and run. And as you can see, now, the result has been printed out. So in that case in this type of functions, we need to wait until the function returns some something to us. And return is very important because not every time we want to just bring something we use, sometimes we just wait we just want devalue, to use it in another function. So for example, we might need this value that we will get from multiply by three and pass it into another function or another part of our program.
And this is very important in complicated applications. And what they want you to do is to practice using these type of functions, the function that will not return anything, it will just do something and execute the code inside it and the function that will return something I want you to practice these well because they are very important and you need to know the difference very well because you will use them a lot