Welcome back everybody.
All right so there's a couple of things that we can actually do here and I'm just going to clean this
up a little bit and I'm just going to go ahead and get rid of that here OK.
So everything still works.
I can type in anything that I want here and everything still works.
It's actually quite a bit.
It's quite awesome here.
Now you can actually call functions within functions.
Now this is really important because you don't want me.
Imagine if you had like a really complicated program that was several pages you wouldn't want all of
that in one function.
You'd want to change it up.
And there's several ways you can do this.
You can actually put another function after the function or sometimes you can actually call a function
in a different file.
It's up to you.
And but one thing we do is let's just go ahead and make another function and we'll call this function
call function work.
Can we add those two brackets.
And of course we need the two curly braces like this.
OK so now that we have a function work here and for some reason that error has been popping up lately
but you don't need to worry about it it just means that my work is not going to get saved.
Now watch this here.
If I go ahead and I cut this out and I pasted in here nothing ends up happening so I typed something
in here and it doesn't work and that makes perfect sense because as of now when we click this button
we're still calling this function here.
Now one thing we could do is we could change this to work and if we change it to work again we can change
it.
And it all works OK.
Simple enough.
But that's not what I want to do.
OK.
Watch this.
So I'm just going to copy and paste it in here.
So we're now calling this function again if you want to call it work.
All you have to do is type in the function name and that's it.
So what's going to happen is that when it calls this function here it's going to go to change the text
and it's just going to call work here.
So if I type in the word fun it should work.
All right.
And that's all it is.
Now you're probably wondering in this specific example this is ridiculous.
Right.
But you do need to call functions later.
And especially in programming it's a fairly important option here.
So especially in games here because if I just go ahead and if you guys are in the game development I
can just show you something.
That's just the kind of a little thing here for games so there is usually an update method.
And what this update method is that it constantly runs on a loop because games always run on loop like
it's always refreshing.
And then you in here you have for example score updates and it calls that function and then you'll have
something like lives update.
You'll have that function player logic etc..
So usually that's something where it would work specifically in games.
That's where you would use this a lot and in a lot of games they do have this where they have a whole
bunch of different options here and sometimes you can even do you know for example player logic and
then it could go to you can go to others.
Now that's all I could do.
Maybe and talk for an hour on this concept here but all I wanted to show you is that you can call other
functions within functions.
All right.
See you guys in the next tutorial.