14- Combining Predicates
Jul 01, 2026 03:47
· 2:10
· English
· Whisper Turbo
· 2 স্পিকার
এই ট্ৰান্সক্ৰিপ্টৰ মেয়াদ আজি শেষ হয়।
স্থায়ী সংৰক্ষণৰ বাবে উন্নীত কৰক →
অকল প্ৰদৰ্শন কৰা হৈছে
0:03
S…
Speaker 1 (14- Combining Predicates)
So we talked about composing functions to build more complex and interesting
0:08
S…
Speaker 1 (14- Combining Predicates)
functions We can also combine predicates to build more complex
0:12
S…
Speaker 1 (14- Combining Predicates)
predicates.
0:12
S…
Speaker 1 (14- Combining Predicates)
Let me show you so I'm going to declare two predicates a
0:16
S…
Speaker 1 (14- Combining Predicates)
predicate of a string called has left brace so
0:21
S…
Speaker 1 (14- Combining Predicates)
str goes to str
0:25
S…
Speaker 1 (14- Combining Predicates)
that starts with a left brace That's a
0:30
S…
Speaker 1 (14- Combining Predicates)
small reusable predicate
0:33
S…
Speaker 1 (14- Combining Predicates)
call the second predicate has right brace and
0:37
S…
Speaker 1 (14- Combining Predicates)
here we call the ends with method and pass
0:41
S…
Speaker 1 (14- Combining Predicates)
a right brace Now we can combine this predicates.
0:45
S…
Speaker 1 (14- Combining Predicates)
Let me show you.
0:45
S…
Speaker 1 (14- Combining Predicates)
So if you type has left brace dot look we
0:49
S…
Speaker 1 (14- Combining Predicates)
have and negate and or these are
0:53
S…
Speaker 1 (14- Combining Predicates)
equivalent to The logical and the logical or and
0:58
S…
Speaker 1 (14- Combining Predicates)
the not operator in Java.
0:59
S…
Speaker 1 (14- Combining Predicates)
So let's say has left brace
1:04
S…
Speaker 1 (14- Combining Predicates)
And here we should pass a second predicate.
1:07
S…
Speaker 1 (14- Combining Predicates)
So we pass has right brace.
1:10
S…
Speaker 1 (14- Combining Predicates)
Now this returns a new predicate.
1:12
S…
Speaker 1 (14- Combining Predicates)
We can store it over here and call it has
1:17
S…
Speaker 1 (14- Combining Predicates)
left and right braces.
1:18
S…
Speaker 1 (14- Combining Predicates)
And then just like any
1:22
S…
Speaker 1 (14- Combining Predicates)
other predicates,
1:23
S…
Speaker 1 (14- Combining Predicates)
we can use that to test an object.
1:27
S…
Speaker 1 (14- Combining Predicates)
So we call a test method and pass a string like this.
1:31
S…
Speaker 1 (14- Combining Predicates)
Key colon value.
1:33
S…
Speaker 1 (14- Combining Predicates)
this returns the result.
1:35
S…
Speaker 1 (14- Combining Predicates)
In this case the result is true because this string has both the left
1:39
S…
Speaker 1 (14- Combining Predicates)
and right braces.
1:40
S…
Speaker 1 (14- Combining Predicates)
Now we can also combine two predicates using a
1:44
S…
Speaker 1 (14- Combining Predicates)
logical OR.
1:44
S…
Speaker 1 (14- Combining Predicates)
So in this case we get a new predicate and this
1:48
S…
Speaker 1 (14- Combining Predicates)
returns true if our input string has either the left or the right brace.
1:53
S…
Speaker 2 (14- Combining Predicates)
Now,
1:54
S…
Speaker 1 (14- Combining Predicates)
what about the negate method?
1:56
S…
Speaker 1 (14- Combining Predicates)
That is pretty straightforward.
1:57
S…
Speaker 1 (14- Combining Predicates)
So we call the negate method and this returns a new predicate
2:02
S…
Speaker 1 (14- Combining Predicates)
that does the opposite of
2:04
S…
Speaker 1 (14- Combining Predicates)
the first predicate.
2:05
S…
Speaker 1 (14- Combining Predicates)
So this is how we can combine predicates.
এই অনুলিপি AI (স্বয়ংক্ৰিয় কথোপকথন স্বীকৃতি) দ্বাৰা সৃষ্টি কৰা হৈছে। ইয়াৰ অন্তৰ্গত ত্ৰুটি থাকিব পাৰে - গুৰুত্বপূৰ্ণ ব্যৱহাৰৰ বাবে মূল অডিঅ'ৰ সৈতে পৰীক্ষা কৰক। AI নীতি
সাৰাংশ
এই ট্ৰান্সক্ৰিপ্টৰ AI সাৰাংশ সৃষ্টি কৰিবলৈ সাৰাংশ ক্লিক কৰক।
সাৰাংশ...
এই অনুলিপিৰ বিষয়ে AI ক প্ৰশ্ন কৰক
এই অনুবাদৰ বিষয়ে যিকোনো প্ৰশ্ন কৰক — AI-এ প্ৰযোজ্য অংশসমূহ বিচাৰি পাব আৰু উত্তৰ দিব।