So in this video we were talking about the functions I have already describe the functions in the TV.
So I we saying again.
So functions are like, uh.
Or telling your co-worker to do something and you take the output from your co-worker.
So it's like there are 50 lines of code which you want to execute like three or four times.
You don't need to copy all of these lines again and again.
So you can just simply write one function and you can call that function three times to execute 50 lines
of code three times.
So it will be very easy and it saves a lot of space and time.
So to declare the function, you need to.
See complete static.
So the static user as the shared member for this class.
So it's first it's a white printing something.
So this is my function.
And here I'm going to share.
It's been.
So this is the function.
So let's copy this one.
In our program there is a function printing something.
Now I can go and guard this one.
That's Randy's.
And here you can see the output of this testing.
Now, I can guard this multiple times.
I can guard this three times, and I can see three outputs.
So you can see you can guard this in a follow.
I then call like 50 or 100 homes or how many times are you going to lose?
Ah.
You can also get the return date from this so that.
Let's rename this function to.
Yes.
We can get to spring payments.
So it's going to bring secret keys to.
It's so secret.
And I can send written keywords using this written keyword.
I can pretend the contents of this secret can be done secretly.
So the contents of this will be written to do this our main course.
So again, just as I knew it would spring, the key is equals to test.
So this test will return something that is the spring and.
That will be assigned to this key role.
So this is very similar to spring.
The key is equal to this value.
Except this value is getting paid to buy that digital function.
Now I can go and print of this one.
Since there is no print statement in this test, we are going to print this key value.
Sort of wondering this.
And here you can see our key areas.
So you can see how useful the functions are or you can just perform some calculations and you can get
only the result.
So it's very organized.
Very.
And this test of function also accepts the parameters.
So you want to do a function that calculates something, you want to send some values to that function.
So let's say in the year going to be.
And the return type is integer because we are going to perform operations on bigger.
I can directly set the time you start.
So this will return the multiplication of that year.
And we.
Now again, the end result is equal to.
It's tough.
And now here you can see that we should also highlighting the parameters in the file that gives me that
beat.
So let's go and get this result.
Now, if you add this and we get divided party, so it's much more flexible, we can see already.
I can also pass the shooting parameters, you guys of pass pass an area as well.
And one more thing, too.
There is these other local variables for this function.
So these are like temporary variables that this that this function uses to do the calculations.
If I go and actually see is goes to find these equals actually you will not get any error because these
are the main functions of variables and these are the local well was for this test.
So what we're actually doing is we are passing the values of these variables which are five and six.
So it's not really, really to stuff the values of eight that is traditional programming six And these
very common six will be copied in this respect to parameters.
We are in B which are local to business for brands.
And we can see we can still see the reserves that we get the output and this is called car value.
So we are just copying the value that is without actually sending out results.
So if you send the address of this variable, we're actually modifying the contents of the address.
So that is the directory reflects this variable.
So let's.
We can refinance into B, so we use our reference.
Reference.
Okay.
We are not changing.
Right?
So let's go and change this one.
Oh, let's see.
Here is equals to.
Yes, Darby.
The attorney.
We're not here to actually witness you being.
This.
Even though when you return this will be stored in the reserve, but that your values will still be
changed.
Now let's go and put into the.
Here, you.
So it's going to end this year.
Where you.
Now you go to five and you score two six, right?
So that's actually a modest return.
And we can see Lloyd.
And the modest one.
So we actually performing operation by passing the addresses of this year and we and we are printing.
Before you.
Yes.
Yeah.
And copy this line and paste here.
So we are actually printing the values before calling the function and after calling the function,
it's going to run this.
And here we can see and before the year values file and after it values that be.
So then we are printing that.
So this is called call by reference.
So that means we are passing our Drosophila into this one.
And this function takes the content of the address and performed the operations and stores in that same
address.
So we are actually modifying the contents of the items.
If you don't do the study, you need to create the object for this and you need to call that using that
object.
So that's how for these functions.