WEBVTT 00:00.360 --> 00:03.660 Hey guys will come back and I'm glad that you are still here. 00:03.690 --> 00:07.230 That means you have patience and you really want to learn. 00:07.240 --> 00:13.680 So from this lecture we are starting something really important that this functions function is similar 00:13.680 --> 00:14.670 to programs. 00:14.680 --> 00:20.430 And so it's a global statement within a program to perform a specific task. 00:20.430 --> 00:26.280 For example you want to do anything you create a function for that and what ever you want to do. 00:26.300 --> 00:28.800 Didn't you just call that particular function. 00:29.010 --> 00:30.890 So there are two of functions. 00:30.960 --> 00:32.590 First is building function. 00:32.640 --> 00:35.210 And the second part is user defined function. 00:35.250 --> 00:42.750 We have already done the whole building function like framed inboard maximum power and there are a lot 00:42.750 --> 00:44.960 more and we want to do double that. 00:45.150 --> 00:48.800 But from this lecture we'll be talking about user defined function. 00:48.960 --> 00:56.290 That means how we can create our own functions and also how to do some specific task orders argument 00:56.310 --> 00:59.820 or disparate meter and how we are going to return a value. 00:59.910 --> 01:04.110 So all these things we be doing from this lecture. 01:04.110 --> 01:09.950 Now the first thing that I want to talk about is syntax and I think that's more programmable function. 01:10.050 --> 01:12.620 So we can discuss some jargons. 01:12.720 --> 01:15.180 Let me started writing a small function. 01:15.200 --> 01:17.010 Do I Do numbers. 01:17.050 --> 01:18.080 We define a function. 01:18.090 --> 01:23.280 All I have to do is use D F and then give the function name. 01:23.280 --> 01:25.130 So it's a user defined function. 01:25.200 --> 01:31.180 That means you can give any name except the 33 words that we have some restriction. 01:31.440 --> 01:34.660 So I will be taking my function name as some f. 01:34.950 --> 01:37.560 So all you have to do is write the function name. 01:37.650 --> 01:43.810 And if you have some words that can be divided into two parts you can use and underscore and right there 01:43.890 --> 01:47.460 where you cannot use a capital or dash. 01:47.490 --> 01:49.220 So this is the naming format. 01:49.350 --> 01:51.900 So if I'm using is underscore F.. 01:51.900 --> 01:57.560 Let me take it simply if for now and now I need to define bounders. 01:57.660 --> 02:00.070 So there are two things that you need to understand. 02:00.090 --> 02:02.910 One experimentor and one is argument. 02:03.030 --> 02:10.170 So whenever we are calling a function we pass some arguments on what argument we to be able to pass 02:10.170 --> 02:11.530 that we need to define here. 02:11.550 --> 02:13.300 That is the on the dust. 02:13.380 --> 02:15.500 Let me simplify it more. 02:15.690 --> 02:20.670 So if I'm doing sum of two numbers might better meters would be to take two numbers. 02:20.670 --> 02:24.330 So number one and number two that would be my paramita. 02:24.510 --> 02:26.420 And what will be my argument. 02:26.540 --> 02:30.090 So if I'm being 5 or seven my I do make will be 5. 02:30.240 --> 02:35.630 And the second argument will be 7 and my paramita will be number one and number two. 02:35.760 --> 02:39.700 So what will that imply that I'm going to get for this particular function. 02:39.750 --> 02:41.800 That would be my power meter. 02:41.820 --> 02:44.810 So let me get two numbers for my son. 02:45.060 --> 02:49.560 Now once you have defined all your power to all you have to do is use a call. 02:49.710 --> 02:52.240 And now inside your function. 02:52.380 --> 02:58.050 So all you have to do is take the first argument take the second and then add them. 02:58.050 --> 03:03.380 So what we can do is create a new way you will see both arguments. 03:03.390 --> 03:04.520 Awesome to see. 03:04.590 --> 03:08.550 And Princie are we can do that inside the brain. 03:08.550 --> 03:10.740 Now here we have defined our function. 03:10.740 --> 03:13.940 The next thing we need to do is to call our function. 03:14.010 --> 03:20.880 So this function is not going to do anything unless and until the caller all up on Chian all we have 03:20.880 --> 03:25.150 to do is write the function name and pass the argument. 03:25.290 --> 03:32.270 So my post on women will be my first number so it will be 10 and if I need to pass my second argument 03:32.670 --> 03:34.680 so I can pass 30. 03:34.740 --> 03:36.450 Now what you are expecting. 03:36.480 --> 03:38.910 So we are calling this particular function. 03:39.100 --> 03:43.320 So it will go into execution where it will check all the arguments. 03:43.320 --> 03:50.610 The argument is going to get 10 Egypt is going to get Toby and then come inside the Sprint statement 03:50.990 --> 03:53.460 and add both numbers and bring back. 03:53.460 --> 03:57.970 Now let us run this program so we can understand the execution. 03:58.230 --> 04:01.330 You can see I got a result of 40 Moldwarp. 04:01.350 --> 04:06.120 This lecture was to make you understand how to create a user defined function. 04:06.120 --> 04:09.840 And this is just a basic indexed for the next decade. 04:10.020 --> 04:14.350 One more examples and that are not malting that begin to function.