1 00:00:01,150 --> 00:00:06,910 In this video we're going to take a look at some alternate forms of syntax around annotations for functions. 2 00:00:06,910 --> 00:00:12,340 So underneath my two functions I already have I'm going to define a another one called divide and you'll 3 00:00:12,340 --> 00:00:15,150 notice I'm going to use the keyword function right here. 4 00:00:15,250 --> 00:00:19,900 So how do we use these annotations with a function defined with the function keyword. 5 00:00:19,900 --> 00:00:22,060 Well basically the exact same way. 6 00:00:22,060 --> 00:00:28,040 So we'll have two arguments A and B and we need to annotate both them. 7 00:00:28,230 --> 00:00:33,090 So we'll say A is going to be a number and B is going to be a number as well. 8 00:00:33,090 --> 00:00:38,610 Then to annotate the return type of this again right after the argument list will put in a colon and 9 00:00:38,610 --> 00:00:41,310 then the type of value we expect to return. 10 00:00:41,400 --> 00:00:45,100 Then we can return a divided by B. 11 00:00:45,130 --> 00:00:52,300 Like so now this syntax is going to also work for anonymous functions assigned to variables too. 12 00:00:52,340 --> 00:00:58,510 So I could say const multiply will be a function. 13 00:00:58,650 --> 00:01:01,830 This will take two arguments of A and B. 14 00:01:01,830 --> 00:01:09,220 Once again both numbers and again right after that argument list we can annotate the return type as 15 00:01:09,220 --> 00:01:10,330 well. 16 00:01:10,330 --> 00:01:12,940 And so then inside the function A times B like so. 17 00:01:12,940 --> 00:01:19,960 And that's pretty much it so anytime that we need to define a function using an arrow a named function 18 00:01:20,410 --> 00:01:26,050 or an anonymous function assigned to a variable we're always going to see a near identical form of syntax 19 00:01:26,050 --> 00:01:30,520 it's always going to be the arguments that the colon and then the expected type. 20 00:01:30,520 --> 00:01:36,010 And then immediately after the closing parentheses we'll do another colon and the expected type of the 21 00:01:36,010 --> 00:01:37,640 return value from the function. 22 00:01:37,660 --> 00:01:39,450 That's pretty much it. 23 00:01:39,470 --> 00:01:42,230 Quick pause here and we'll talk about one less thing in the next video.