1 00:00:01,260 --> 00:00:06,100 Hiding the strings of the heart once again in the previous video we talked about the freezer and math 2 00:00:06,180 --> 00:00:06,970 matters. 3 00:00:06,990 --> 00:00:10,730 Now in this video there is talk about 30 kids in case of Cartland. 4 00:00:10,840 --> 00:00:12,770 Now they're pretty good in simple words. 5 00:00:12,810 --> 00:00:18,010 It is just a condition that simply returns a boolean value of true and false. 6 00:00:18,030 --> 00:00:20,160 So what are predicates functions. 7 00:00:20,160 --> 00:00:25,850 So here we have all any gonged and find so that all the better. 8 00:00:25,920 --> 00:00:27,510 Simply ask a question. 9 00:00:27,630 --> 00:00:32,490 Do all elements satisfy the predicate or the condition. 10 00:00:32,740 --> 00:00:35,330 So it was simply return either true or false. 11 00:00:35,350 --> 00:00:37,050 That is a boolean value. 12 00:00:37,050 --> 00:00:39,660 Now here down the side I have any. 13 00:00:39,690 --> 00:00:42,940 So does any method simply ask a simple question. 14 00:00:43,050 --> 00:00:48,640 Do any of the elements present inside the list satisfy that condition or the predicate. 15 00:00:48,780 --> 00:00:52,660 And it is simply again return true or false. 16 00:00:52,660 --> 00:00:59,040 Now downness I have a count mattered there are simply Richter's that are the number of elements that 17 00:00:59,040 --> 00:01:01,550 satisfy the condition or the predicate. 18 00:01:01,770 --> 00:01:08,440 And at last I have a Find method that simply returns the first element that satisfy the predicate. 19 00:01:08,610 --> 00:01:12,910 So from the list it will simply check out the first element from the starting. 20 00:01:12,910 --> 00:01:16,540 There is simply to satisfy their condition and simply return. 21 00:01:16,710 --> 00:01:23,770 So let's check out the code in action inside the intelligence the so here again I have the list of numbers 22 00:01:23,860 --> 00:01:27,090 2 3 4 6 23 and 90 and so on. 23 00:01:27,220 --> 00:01:33,780 Now let us start using the functions of the predicate such as my numbers dog. 24 00:01:33,880 --> 00:01:34,370 All. 25 00:01:34,420 --> 00:01:36,410 Let's start with all Metford. 26 00:01:36,520 --> 00:01:40,440 This all method simply expects a lambda function right. 27 00:01:40,500 --> 00:01:45,770 So here I would simply define the lambda function that will be actually a condition. 28 00:01:45,790 --> 00:01:52,680 So here I would simply use num going into num greater than 10. 29 00:01:53,040 --> 00:01:56,190 So find all the numbers that satisfy this condition. 30 00:01:56,250 --> 00:01:56,570 Right. 31 00:01:56,580 --> 00:01:58,490 It simply means this only. 32 00:01:58,620 --> 00:02:06,320 Now since here we have only one parameter name so it can be replaced by a ate greater than 10. 33 00:02:06,320 --> 00:02:11,350 Now this all Metford simply returns a boolean value. 34 00:02:11,460 --> 00:02:16,410 So I would simply use Val check when equal to my numbers. 35 00:02:16,450 --> 00:02:17,370 Not all. 36 00:02:17,700 --> 00:02:22,680 So this statement simply ask that are all the elements greater than 10. 37 00:02:22,740 --> 00:02:24,880 If it is then simply returns true. 38 00:02:24,960 --> 00:02:27,280 If not then simply returns false. 39 00:02:27,690 --> 00:02:33,570 So in either case it will simply return false because all the numbers are not greater than 10. 40 00:02:33,600 --> 00:02:39,780 Now if you notice here it all is a function that takes the first parameter as a land expression. 41 00:02:39,960 --> 00:02:46,760 So you can also use the function type here as well. 42 00:02:46,970 --> 00:02:50,230 So as a first fearmonger I'm simply passing a lambda. 43 00:02:50,330 --> 00:02:53,860 Now the purpose Vaj I'm using a function here shortly. 44 00:02:53,880 --> 00:02:55,200 Let you know. 45 00:02:55,250 --> 00:02:58,260 Now here let us print the check when. 46 00:02:58,640 --> 00:03:02,330 So as expected we get false in the output console. 47 00:03:02,330 --> 00:03:04,670 Now there us use my numbers. 48 00:03:04,670 --> 00:03:05,970 Got any. 49 00:03:06,140 --> 00:03:09,630 So this any method simply expects a predicate. 50 00:03:09,650 --> 00:03:15,330 So here inside the function I will simply pass the number expression about. 51 00:03:15,530 --> 00:03:19,830 Let's see now I'm going into name greater than 10. 52 00:03:19,980 --> 00:03:20,930 Now here again. 53 00:03:20,940 --> 00:03:22,950 Let's just replace it by it. 54 00:03:22,980 --> 00:03:25,650 So this statement simply asked the question. 55 00:03:25,650 --> 00:03:30,120 Does any of these elements satisfy the condition or the predicate. 56 00:03:30,980 --> 00:03:37,360 So here we have few of the elements such as 23 and 90 that simply satisfy this predicate. 57 00:03:37,430 --> 00:03:39,920 Right so it will simply return true. 58 00:03:39,970 --> 00:03:42,040 So there does use a boolean variable. 59 00:03:42,090 --> 00:03:45,820 Val checked to equal to name. 60 00:03:45,830 --> 00:03:50,120 Now this check is actually of the type of boolean. 61 00:03:50,120 --> 00:03:58,250 So I guess no doubt in this very simple and then simply print out the check to so in the output we get 62 00:03:58,400 --> 00:03:59,740 through here as well. 63 00:03:59,990 --> 00:04:03,830 And now proceeding forward let's just not check out the count. 64 00:04:03,980 --> 00:04:06,310 So my numbers don't count. 65 00:04:06,650 --> 00:04:12,850 So here again I would simply pass the lambda expression Lerche see 80 rather than 10. 66 00:04:13,040 --> 00:04:18,290 So this statement will simply return the number of elements that satisfy the predicate. 67 00:04:18,500 --> 00:04:21,140 So it will simply return the integer value. 68 00:04:21,250 --> 00:04:25,730 Let's say Val total count equal to my numbers. 69 00:04:25,730 --> 00:04:29,030 Now this will be of the type of integer right. 70 00:04:29,550 --> 00:04:34,600 And now let's just print out the value of Godel code. 71 00:04:35,390 --> 00:04:36,740 So here we have two. 72 00:04:36,770 --> 00:04:38,610 So there are only two numbers. 73 00:04:38,660 --> 00:04:43,530 That is 23 and 90 deg to satisfy our condition or the predicate. 74 00:04:43,610 --> 00:04:49,750 Now at the end I have learned see my numbers and dord find. 75 00:04:49,840 --> 00:04:52,990 Now this again expects a lambda as our first var.. 76 00:04:53,050 --> 00:04:54,090 So I would simply use. 77 00:04:54,200 --> 00:04:56,880 Id to that and then the condition will be the same. 78 00:04:56,950 --> 00:05:01,410 And here it will simply return the first number that matches the predicate. 79 00:05:01,570 --> 00:05:05,830 So it will simply start counting from 2 and look for the. 80 00:05:06,040 --> 00:05:10,120 And look for the integer variable that simply matches the condition. 81 00:05:10,120 --> 00:05:11,400 That is a predicate. 82 00:05:11,710 --> 00:05:15,240 So as soon as it reaches 23 the condition becomes true. 83 00:05:15,310 --> 00:05:18,410 So 23 actually satisfies this condition. 84 00:05:18,420 --> 00:05:25,930 I do agree to that and then so it will be then stored inside the value of Lerche see name equal to my 85 00:05:25,930 --> 00:05:29,320 numbers right and now they're desperate in doubt. 86 00:05:29,800 --> 00:05:30,160 Alan 87 00:05:32,990 --> 00:05:34,550 and now they're just called 88 00:05:38,470 --> 00:05:43,400 so here in the output we have 23 and we did not get 90 in the output. 89 00:05:43,420 --> 00:05:50,110 And so because Greenberry is a first element starting from the list Darrett satisfy the version of legacy 90 00:05:50,150 --> 00:05:51,900 idea dead and. 91 00:05:52,330 --> 00:05:56,420 Now if you check out the documentation of the find you will find out. 92 00:05:56,500 --> 00:06:02,230 It simply returns the first element matching that given condition or the predicate or null. 93 00:06:02,290 --> 00:06:04,510 If newsis element was found. 94 00:06:04,690 --> 00:06:11,200 So this simply shows that this number is of the type of the label integer right. 95 00:06:11,230 --> 00:06:14,320 So it can also contain the null value. 96 00:06:14,550 --> 00:06:20,930 And now if you notice here that in each of the function we have the repetition of the predicate I degraded 97 00:06:20,940 --> 00:06:21,250 then. 98 00:06:21,280 --> 00:06:25,350 Then Id get rid of that and 10 and so on here as well. 99 00:06:25,590 --> 00:06:32,080 So I said in the previous videos that we can still the lambda function as a variable. 100 00:06:32,100 --> 00:06:34,670 So here what they really do is simply define. 101 00:06:34,700 --> 00:06:46,000 Let's say my lambda Let's see my predicate to be more specific equal to let's say 80 rather than 10. 102 00:06:46,000 --> 00:06:50,020 Now the compiler don't understand Vargus ideas transfer here. 103 00:06:51,330 --> 00:06:55,590 Because here the ID is standing in context of my numbers. 104 00:06:55,590 --> 00:07:02,410 So all the numbers here are being represented as I-T in context of my numbers which is a list of numbers. 105 00:07:02,490 --> 00:07:04,930 But here we don't have any list present here. 106 00:07:04,950 --> 00:07:08,090 So the compiler does not understand vord business. 107 00:07:08,140 --> 00:07:18,860 It is transferred so far that you have to simply use the NUM variable going into no greater than 10. 108 00:07:18,860 --> 00:07:20,610 Now again we have some error. 109 00:07:20,630 --> 00:07:21,680 What is a typo. 110 00:07:21,680 --> 00:07:23,290 This number is variable. 111 00:07:23,510 --> 00:07:25,980 So you need to specify it here as well. 112 00:07:25,990 --> 00:07:29,140 And so this completes our lambda function. 113 00:07:29,300 --> 00:07:36,550 Now now instead of using the grid there and everywhere you can simply replace it by my predicate here. 114 00:07:37,010 --> 00:07:40,940 And again my predicate here and here as well. 115 00:07:41,030 --> 00:07:43,860 Let's just replace it by the function. 116 00:07:43,910 --> 00:07:48,220 My predicate remove it from here. 117 00:07:49,000 --> 00:07:50,540 And on the side here as well. 118 00:07:50,640 --> 00:07:56,410 Lordsburg the brackets inside of which my predicate and null let us read the code. 119 00:07:57,510 --> 00:08:01,280 So here as well we are getting the same output in the output console. 120 00:08:01,410 --> 00:08:10,580 So always remember this about all any gownd and find now there are lots of other metrics as well that 121 00:08:10,640 --> 00:08:13,320 you can find here such as last 122 00:08:15,850 --> 00:08:23,250 last then and so on you can get all these methods down the side. 123 00:08:23,390 --> 00:08:27,300 So as of now I just showed you all the important metrics. 124 00:08:27,320 --> 00:08:29,760 So this video was just to show you. 125 00:08:29,760 --> 00:08:33,090 Valke are pretty scarce in case of Coquelin So they're pretty good. 126 00:08:33,100 --> 00:08:38,990 In short are just a condition that I have declared with the help of a lambda function. 127 00:08:38,990 --> 00:08:45,150 So always remember the predicates are just a condition that returns either true or false. 128 00:08:45,170 --> 00:08:47,020 So this was all about this video. 129 00:08:47,060 --> 00:08:48,160 Thanks for watching. 130 00:08:48,280 --> 00:08:49,430 Start signing off. 131 00:08:49,490 --> 00:08:51,010 Thank you and have a good day.