In this video, we're going to take a look at some alternate forms of syntax around annotations for
functions.
So underneath my two functions I already have, I'm going to define another one called Divide, and
you'll notice I'm going to use the key word function right here.
So how do we use these annotations with a function defined with a function keyword?
Well, basically the exact same way.
So we'll have two arguments.
A and B, and we need to annotate both them, so we'll say A is going to be A no and B is going to be
a number as well.
Then to annotate the return type of this again, right after the argument list will put in a colon and
then the type of value we expect to return.
Then we can return.
A divided by B like so.
Now, his syntax is going to also work for anonymous functions assigned to variables, too, so I could
say const multiply.
Will be a function.
This will take two arguments of A and B once again, both numbers.
And again, right after that argument list, we can annotate the return type as well, and so then inside
the function A times, B like so and that's pretty much it.
So any time that we need to define a function using an arrow, a named function or an anonymous function
assigned to a variable, we're always going to see a near identical form of syntax.
It's always going to be the arguments with the colon and then the expected type.
And then immediately after the closing parentheses, we'll do another colon and the expected type of
the return value from the function.
And that's pretty much it.
OK, quick pause here and we'll talk about one last thing in the next video.