1 00:00:13,630 --> 00:00:19,660 Hello and welcome to the golden programming language course in the previous session, we talked about 2 00:00:19,660 --> 00:00:21,250 function arguments. 3 00:00:21,670 --> 00:00:26,260 And in this session, we want to talk about the other functions concept. 4 00:00:30,830 --> 00:00:33,380 Anonymous function in gold language. 5 00:00:34,400 --> 00:00:43,190 Google AdWords provides a special feature known as an anonymous function, an anonymous function is 6 00:00:43,190 --> 00:00:46,190 a function which doesn't contain any name. 7 00:00:46,910 --> 00:00:52,310 It's useful when you want to create an inline function in goal. 8 00:00:52,310 --> 00:00:59,990 Language and anonymised function can form a closer and anonymous function is also known as functionality. 9 00:01:00,060 --> 00:01:03,740 Right now, you can see the syntax. 10 00:01:05,830 --> 00:01:11,290 In this case, we want to examine the defensive stays of the anonymous function. 11 00:01:12,490 --> 00:01:15,130 First, simple, anonymous function. 12 00:01:16,210 --> 00:01:23,580 Second, in go language, you are allowed to sign an anonymous function to a variable term. 13 00:01:24,040 --> 00:01:32,950 You can also pass are humans in the anonymised function and Foles function defined to exit a parameter 14 00:01:33,100 --> 00:01:34,570 and return value? 15 00:01:35,560 --> 00:01:41,110 Now go to your school program to illustrate how to create an anonymous function. 16 00:01:42,870 --> 00:01:51,960 First, simple, anonymous function, first, write the following keyboard, open and close parentheses 17 00:01:51,960 --> 00:01:53,220 and curly brackets. 18 00:01:53,880 --> 00:01:58,830 Now write our codes in body of font fold in example. 19 00:01:58,920 --> 00:02:02,970 50. Printed and set the message and end of closed broadcast. 20 00:02:03,000 --> 00:02:07,880 It's another open and close parenthesis and execute the program. 21 00:02:08,160 --> 00:02:10,050 Now do you sample? 22 00:02:11,140 --> 00:02:21,230 Fine, open and close Francis's curly brackets and end of the close brackets put open and close, prompted 23 00:02:21,250 --> 00:02:23,950 again and in the body of function. 24 00:02:24,100 --> 00:02:40,030 Write your statements for the example, if be then called to go through the rhyming language, reformat 25 00:02:40,030 --> 00:02:43,780 the code and see the project execute the code. 26 00:02:52,700 --> 00:03:00,550 Now we can see the output welcome to go programming language, defined and anonymised function and execute 27 00:03:00,590 --> 00:03:03,020 it and see the printed message. 28 00:03:04,040 --> 00:03:11,900 Second, set in goal language, you ought to know to sign an anonymous function to evaluate the first 29 00:03:12,500 --> 00:03:13,940 clear last code, 30 00:03:17,090 --> 00:03:27,440 define the local variable like resolved calling equals and create an anonymous function and assign it 31 00:03:27,440 --> 00:03:38,810 to defined very the fine, open and close parenthesis curly brackets and display in the sage fine print 32 00:03:38,810 --> 00:03:40,940 at function FP. 33 00:03:42,410 --> 00:03:48,740 Welcome to blue language. 34 00:03:49,520 --> 00:03:56,810 When you assign the function to a variable, then the type of the variable is a function type and you 35 00:03:56,810 --> 00:04:06,080 can command a variable like function call as shown in this case, resolved open and close PRANCES is 36 00:04:06,410 --> 00:04:10,670 reformat to call and see if the project and execute the program. 37 00:04:12,920 --> 00:04:20,450 Now we can sit out with welcome to go language first, we define an anonymous function and assign it 38 00:04:20,450 --> 00:04:21,140 to a value. 39 00:04:21,590 --> 00:04:29,480 So type of variable changes to function time then invoke variable as a function, an anonymous function, 40 00:04:29,480 --> 00:04:32,150 execute and see the printed receipts. 41 00:04:33,230 --> 00:04:34,000 Turn to the state. 42 00:04:34,430 --> 00:04:40,310 You can also pass arguements in the anonymous function first to your last school. 43 00:04:45,870 --> 00:04:48,160 Define an anonymous function. 44 00:04:48,790 --> 00:04:58,510 Phone open Frances's and set parameters as passing arguments and anonymised function like name as string 45 00:04:58,530 --> 00:05:07,320 Typekit and go to the body of function and display the created parameters by the brain function, follow 46 00:05:07,320 --> 00:05:11,150 the example of p name. 47 00:05:12,900 --> 00:05:20,880 Put an open and close parenthesis and in this prances is the initialize our parameters for the exam 48 00:05:20,880 --> 00:05:21,270 pattern. 49 00:05:22,020 --> 00:05:31,350 Welcome to the language reformat the code, says the project and execute the program. 50 00:05:33,650 --> 00:05:35,090 Now we can see the with. 51 00:05:35,880 --> 00:05:44,720 Welcome to go language, in this case, we define an anonymous function and set a parameter and initialize 52 00:05:44,720 --> 00:05:54,200 it so we could pass arguments in the anonymize function and force function defined to accept a parameter 53 00:05:54,200 --> 00:05:55,400 and return value. 54 00:05:55,910 --> 00:05:57,620 First, clear the last call. 55 00:06:01,370 --> 00:06:08,720 We want to return value of area of a rectangle and display it first, right, a display message and 56 00:06:08,720 --> 00:06:11,570 create an anonymous function inside it. 57 00:06:12,140 --> 00:06:32,060 For the example, at Earth, correct angled area by 10, value equals per cent the back end. 58 00:06:32,660 --> 00:06:40,040 And here, for initialize the conversion character, we create an anonymised function that return the 59 00:06:40,040 --> 00:06:40,460 value. 60 00:06:40,670 --> 00:06:42,200 So do the following. 61 00:06:46,460 --> 00:06:54,630 You, for the example, the Pirates are like that and you buy time off and return while you eat. 62 00:06:55,290 --> 00:07:00,300 And clearly rockets and we want to calculate rectangle earlier. 63 00:07:00,420 --> 00:07:13,440 So return W multiplication W and end of curly brackets in the panties is set the parameter for the example 64 00:07:13,440 --> 00:07:15,840 10 value v format. 65 00:07:15,840 --> 00:07:19,980 They call and say the project and execute the program. 66 00:07:22,560 --> 00:07:27,660 Now we can see the output rectangle area by 10, value equals 100. 67 00:07:27,780 --> 00:07:34,680 We could define an anonymous function that accept the promise or return a value we have reached end 68 00:07:34,680 --> 00:07:35,540 of decision. 69 00:07:35,550 --> 00:07:39,510 I hope you have taken full advantage of decision until next session. 70 00:07:39,540 --> 00:07:40,130 Goodbye.