Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,810 --> 00:00:07,920
Now in the last lesson we looked at how we can use comparatives, such as greater than or is equal to, in
2
00:00:07,920 --> 00:00:14,450
order to send a different alert to people who got love scores above 70 and those who got below 70.
3
00:00:14,500 --> 00:00:23,310
Now, what if we could find tune that even further? What if we could say, if somebody got above 30 but
4
00:00:23,580 --> 00:00:28,610
below 70, then they should get a different alert from the other scores?
5
00:00:28,680 --> 00:00:35,820
Well to do this we would have to combine our comparatives. And the three basic comparatives are two ampersands
6
00:00:35,940 --> 00:00:36,330
for
7
00:00:36,390 --> 00:00:43,760
AND, so whether if condition one is true and condition two is true. You can check to see if either
8
00:00:43,770 --> 00:00:47,940
condition one is true or condition two is true
9
00:00:48,060 --> 00:00:48,870
by using the
10
00:00:48,960 --> 00:00:50,240
OR command,
11
00:00:50,400 --> 00:00:56,230
and you can do this using two pipe signs, and that's the straight lines that you see on your keyboard.
12
00:00:56,250 --> 00:01:02,820
And finally, as we've seen already, the exclamation mark means NOT, or the opposite of something.
13
00:01:02,820 --> 00:01:04,880
So let's take a look at this in practice.
14
00:01:04,890 --> 00:01:12,360
So, in between the if and else, let's say we added another if statement and we said, if the love score
15
00:01:12,450 --> 00:01:15,410
was greater than 30,
16
00:01:15,450 --> 00:01:22,060
so this is condition one, and we combine it using the AND, which are two ampersand symbols on the keyboard,
17
00:01:22,370 --> 00:01:28,380
and the second condition is love score is less than or equal to 70.
18
00:01:28,380 --> 00:01:34,860
So under this condition we can give people the alert of their love score. If the love score was greater
19
00:01:34,860 --> 00:01:35,720
than 70,
20
00:01:35,730 --> 00:01:42,090
we tell them that they love each other like Kanye and Kanye, and if they got a really low score, if love
21
00:01:42,090 --> 00:01:50,790
score was less than or equal to 30, then we tell them that your love score is this and we give them
22
00:01:51,030 --> 00:01:52,360
a different message,
23
00:01:52,380 --> 00:02:01,190
for example. So now when we run our code, depending on what we got as a random number, then it will
24
00:02:01,220 --> 00:02:04,070
execute different parts of our code.
25
00:02:04,340 --> 00:02:09,110
So say if we got above 70 then we get the Kanye loves Kanye.
26
00:02:09,290 --> 00:02:16,250
If we got between 30 and 70 then we just get the simple love score, and if we get below 30, then we get
27
00:02:16,250 --> 00:02:19,210
told that you go together like oil and water.
28
00:02:19,430 --> 00:02:25,100
So this is achieved by using a bunch of if statements that check whether if different conditions are
29
00:02:25,100 --> 00:02:32,540
true at the time when we run the code and then we use comparatives to compare the value of a particular
30
00:02:32,540 --> 00:02:36,270
variable against another variable or another value.
31
00:02:36,290 --> 00:02:42,710
And finally we used combo moves like the AND in order to check whether if two different conditions
32
00:02:43,010 --> 00:02:46,880
are both true at the time of checking.
3368
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.