1 00:00:00,300 --> 00:00:05,490 So in this video we were talking about the functions I have already describe the functions in the TV. 2 00:00:05,820 --> 00:00:07,920 So I we saying again. 3 00:00:08,190 --> 00:00:10,320 So functions are like, uh. 4 00:00:12,940 --> 00:00:19,960 Or telling your co-worker to do something and you take the output from your co-worker. 5 00:00:22,610 --> 00:00:32,000 So it's like there are 50 lines of code which you want to execute like three or four times. 6 00:00:32,210 --> 00:00:36,050 You don't need to copy all of these lines again and again. 7 00:00:36,290 --> 00:00:43,550 So you can just simply write one function and you can call that function three times to execute 50 lines 8 00:00:43,550 --> 00:00:44,480 of code three times. 9 00:00:44,990 --> 00:00:52,070 So it will be very easy and it saves a lot of space and time. 10 00:00:52,730 --> 00:00:55,070 So to declare the function, you need to. 11 00:00:57,470 --> 00:01:01,400 See complete static. 12 00:01:01,790 --> 00:01:06,590 So the static user as the shared member for this class. 13 00:01:07,580 --> 00:01:11,690 So it's first it's a white printing something. 14 00:01:11,780 --> 00:01:13,280 So this is my function. 15 00:01:13,670 --> 00:01:15,530 And here I'm going to share. 16 00:01:18,520 --> 00:01:19,210 It's been. 17 00:01:22,330 --> 00:01:24,070 So this is the function. 18 00:01:24,100 --> 00:01:25,210 So let's copy this one. 19 00:01:25,930 --> 00:01:29,380 In our program there is a function printing something. 20 00:01:29,770 --> 00:01:31,570 Now I can go and guard this one. 21 00:01:35,220 --> 00:01:35,930 That's Randy's. 22 00:01:35,940 --> 00:01:38,280 And here you can see the output of this testing. 23 00:01:38,670 --> 00:01:42,960 Now, I can guard this multiple times. 24 00:01:43,050 --> 00:01:47,340 I can guard this three times, and I can see three outputs. 25 00:01:47,460 --> 00:01:50,160 So you can see you can guard this in a follow. 26 00:01:51,040 --> 00:01:55,990 I then call like 50 or 100 homes or how many times are you going to lose? 27 00:01:59,670 --> 00:01:59,780 Ah. 28 00:01:59,850 --> 00:02:04,080 You can also get the return date from this so that. 29 00:02:07,850 --> 00:02:09,290 Let's rename this function to. 30 00:02:10,670 --> 00:02:10,930 Yes. 31 00:02:16,070 --> 00:02:18,730 We can get to spring payments. 32 00:02:21,310 --> 00:02:27,630 So it's going to bring secret keys to. 33 00:02:29,800 --> 00:02:31,060 It's so secret. 34 00:02:32,990 --> 00:02:37,010 And I can send written keywords using this written keyword. 35 00:02:37,010 --> 00:02:41,480 I can pretend the contents of this secret can be done secretly. 36 00:02:41,480 --> 00:02:47,490 So the contents of this will be written to do this our main course. 37 00:02:47,510 --> 00:02:52,430 So again, just as I knew it would spring, the key is equals to test. 38 00:02:52,820 --> 00:02:57,200 So this test will return something that is the spring and. 39 00:02:58,590 --> 00:03:00,590 That will be assigned to this key role. 40 00:03:00,990 --> 00:03:02,820 So this is very similar to spring. 41 00:03:02,820 --> 00:03:05,760 The key is equal to this value. 42 00:03:09,050 --> 00:03:14,570 Except this value is getting paid to buy that digital function. 43 00:03:15,560 --> 00:03:17,900 Now I can go and print of this one. 44 00:03:18,440 --> 00:03:23,360 Since there is no print statement in this test, we are going to print this key value. 45 00:03:25,250 --> 00:03:26,180 Sort of wondering this. 46 00:03:26,420 --> 00:03:28,310 And here you can see our key areas. 47 00:03:29,840 --> 00:03:38,000 So you can see how useful the functions are or you can just perform some calculations and you can get 48 00:03:38,000 --> 00:03:38,870 only the result. 49 00:03:39,380 --> 00:03:42,790 So it's very organized. 50 00:03:42,800 --> 00:03:43,070 Very. 51 00:03:44,390 --> 00:03:47,600 And this test of function also accepts the parameters. 52 00:03:47,840 --> 00:03:53,930 So you want to do a function that calculates something, you want to send some values to that function. 53 00:03:54,110 --> 00:03:56,150 So let's say in the year going to be. 54 00:04:00,030 --> 00:04:06,540 And the return type is integer because we are going to perform operations on bigger. 55 00:04:09,970 --> 00:04:13,330 I can directly set the time you start. 56 00:04:13,810 --> 00:04:17,480 So this will return the multiplication of that year. 57 00:04:17,500 --> 00:04:17,980 And we. 58 00:04:23,090 --> 00:04:26,580 Now again, the end result is equal to. 59 00:04:30,950 --> 00:04:31,790 It's tough. 60 00:04:31,820 --> 00:04:39,920 And now here you can see that we should also highlighting the parameters in the file that gives me that 61 00:04:39,920 --> 00:04:40,220 beat. 62 00:04:40,370 --> 00:04:42,290 So let's go and get this result. 63 00:04:43,010 --> 00:04:49,340 Now, if you add this and we get divided party, so it's much more flexible, we can see already. 64 00:04:52,830 --> 00:04:58,700 I can also pass the shooting parameters, you guys of pass pass an area as well. 65 00:05:09,690 --> 00:05:12,030 And one more thing, too. 66 00:05:12,450 --> 00:05:15,990 There is these other local variables for this function. 67 00:05:16,020 --> 00:05:22,620 So these are like temporary variables that this that this function uses to do the calculations. 68 00:05:23,280 --> 00:05:30,570 If I go and actually see is goes to find these equals actually you will not get any error because these 69 00:05:30,570 --> 00:05:34,890 are the main functions of variables and these are the local well was for this test. 70 00:05:35,400 --> 00:05:42,900 So what we're actually doing is we are passing the values of these variables which are five and six. 71 00:05:43,320 --> 00:05:51,120 So it's not really, really to stuff the values of eight that is traditional programming six And these 72 00:05:51,120 --> 00:05:55,440 very common six will be copied in this respect to parameters. 73 00:05:56,390 --> 00:05:59,930 We are in B which are local to business for brands. 74 00:05:59,930 --> 00:06:09,440 And we can see we can still see the reserves that we get the output and this is called car value. 75 00:06:09,470 --> 00:06:15,020 So we are just copying the value that is without actually sending out results. 76 00:06:15,260 --> 00:06:20,750 So if you send the address of this variable, we're actually modifying the contents of the address. 77 00:06:20,960 --> 00:06:24,800 So that is the directory reflects this variable. 78 00:06:25,250 --> 00:06:25,790 So let's. 79 00:06:27,870 --> 00:06:33,450 We can refinance into B, so we use our reference. 80 00:06:33,870 --> 00:06:34,470 Reference. 81 00:06:37,270 --> 00:06:37,570 Okay. 82 00:06:37,570 --> 00:06:38,770 We are not changing. 83 00:06:38,770 --> 00:06:39,070 Right? 84 00:06:39,070 --> 00:06:40,690 So let's go and change this one. 85 00:06:41,470 --> 00:06:42,400 Oh, let's see. 86 00:06:42,520 --> 00:06:43,750 Here is equals to. 87 00:06:46,230 --> 00:06:47,280 Yes, Darby. 88 00:06:50,850 --> 00:06:51,630 The attorney. 89 00:06:55,220 --> 00:06:57,680 We're not here to actually witness you being. 90 00:07:00,680 --> 00:07:00,930 This. 91 00:07:02,130 --> 00:07:08,690 Even though when you return this will be stored in the reserve, but that your values will still be 92 00:07:08,700 --> 00:07:09,030 changed. 93 00:07:09,450 --> 00:07:11,700 Now let's go and put into the. 94 00:07:15,640 --> 00:07:16,540 Here, you. 95 00:07:17,660 --> 00:07:18,900 So it's going to end this year. 96 00:07:18,900 --> 00:07:19,310 Where you. 97 00:07:22,420 --> 00:07:25,210 Now you go to five and you score two six, right? 98 00:07:25,540 --> 00:07:28,570 So that's actually a modest return. 99 00:07:28,570 --> 00:07:30,630 And we can see Lloyd. 100 00:07:37,310 --> 00:07:38,330 And the modest one. 101 00:07:39,320 --> 00:07:45,530 So we actually performing operation by passing the addresses of this year and we and we are printing. 102 00:07:49,600 --> 00:07:52,070 Before you. 103 00:07:52,530 --> 00:07:53,250 Yes. 104 00:07:55,620 --> 00:07:55,890 Yeah. 105 00:07:56,670 --> 00:07:59,160 And copy this line and paste here. 106 00:07:59,280 --> 00:08:07,740 So we are actually printing the values before calling the function and after calling the function, 107 00:08:08,430 --> 00:08:09,390 it's going to run this. 108 00:08:09,900 --> 00:08:16,950 And here we can see and before the year values file and after it values that be. 109 00:08:17,670 --> 00:08:19,740 So then we are printing that. 110 00:08:20,160 --> 00:08:23,340 So this is called call by reference. 111 00:08:23,350 --> 00:08:26,880 So that means we are passing our Drosophila into this one. 112 00:08:27,030 --> 00:08:34,080 And this function takes the content of the address and performed the operations and stores in that same 113 00:08:34,080 --> 00:08:34,530 address. 114 00:08:34,560 --> 00:08:37,910 So we are actually modifying the contents of the items. 115 00:08:41,320 --> 00:08:45,880 If you don't do the study, you need to create the object for this and you need to call that using that 116 00:08:45,880 --> 00:08:46,270 object. 117 00:08:48,110 --> 00:08:50,600 So that's how for these functions.