Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,610 --> 00:00:01,650
Hi there, guys.
2
00:00:01,720 --> 00:00:06,040
In this video, we are going to talk about relational operators.
3
00:00:06,580 --> 00:00:12,190
Well, the name itself is kind of scary, but there is no need for panic just yet.
4
00:00:12,640 --> 00:00:20,080
Relational operators are used in conditions and they simply tell you how you are going to ask a certain
5
00:00:20,080 --> 00:00:20,800
question.
6
00:00:21,040 --> 00:00:25,350
For example, how you are going to ask if a grade is higher than 80.
7
00:00:25,570 --> 00:00:32,740
In our programming language and actually we've seen a couple of examples in the previous videos where
8
00:00:32,740 --> 00:00:38,050
we use these relational operators probably without even noticing that.
9
00:00:38,260 --> 00:00:44,650
And to tell you the truth, guys, you as a future programmer, you must be familiar with all of these
10
00:00:44,650 --> 00:00:51,030
terms that we've used so far and all of the terms that we are going to use in these course.
11
00:00:51,340 --> 00:00:57,580
And that's why in this video, we are going to talk about it in more detail and use a little bit of
12
00:00:57,580 --> 00:00:58,960
more formality.
13
00:00:59,230 --> 00:01:04,390
So we talked about different rules that should be followed in every programming language.
14
00:01:04,420 --> 00:01:06,190
You do remember that, right?
15
00:01:06,580 --> 00:01:07,960
So the same goes here.
16
00:01:08,260 --> 00:01:14,020
There are things and rules that should be applied when constructing conditions.
17
00:01:14,290 --> 00:01:14,890
Now you sing.
18
00:01:14,890 --> 00:01:19,270
I sing most of the programming languages when you would like to ask a question.
19
00:01:19,720 --> 00:01:22,750
It won't be simply enough to ask for it in English.
20
00:01:22,750 --> 00:01:26,020
Something like if grade is greater than 80.
21
00:01:26,260 --> 00:01:32,800
So we are interested in constructing the conditions in our programming language, just like we've seen
22
00:01:32,800 --> 00:01:34,270
in previous examples.
23
00:01:34,570 --> 00:01:41,830
And that's exactly the place and the time when we would like to use relational operators that will help
24
00:01:41,830 --> 00:01:43,960
us with this task.
25
00:01:44,170 --> 00:01:50,950
So relational operators are just these signs, which you've probably seen most of them somewhere before,
26
00:01:51,250 --> 00:01:53,230
maybe even on your math classes.
27
00:01:54,220 --> 00:02:01,240
And the first one, the greater them, helps in constructing a condition to check if the left side is
28
00:02:01,240 --> 00:02:02,890
greater than the right side.
29
00:02:03,190 --> 00:02:08,320
Then we have the greater than or equals two, which is pretty much the same.
30
00:02:08,710 --> 00:02:14,980
It simply checks if the left side is greater than the right side or if the left side equals to the right
31
00:02:14,980 --> 00:02:15,370
side.
32
00:02:15,610 --> 00:02:22,690
So if either of these options happens to be true, then the result of the condition will be true.
33
00:02:22,960 --> 00:02:30,610
So in most cases, if we would like to ask a question like if grade is greater than 80, we are probably
34
00:02:30,610 --> 00:02:32,350
going to do it in this way.
35
00:02:32,620 --> 00:02:39,220
We are going to use of the greater than relational operator assign and simply put, the grade, which
36
00:02:39,220 --> 00:02:43,390
is a variable on its left and the value of eighty on its right.
37
00:02:43,810 --> 00:02:50,200
And if this condition happens to be true, meaning that grade is actually is greater than 80, we are
38
00:02:50,200 --> 00:02:54,440
going to execute some of their following commands that we would like to execute.
39
00:02:54,640 --> 00:02:59,320
And the same goes for the less then and the less then or equals to science.
40
00:02:59,770 --> 00:03:04,440
They are pretty much the same as we use the greater than the last.
41
00:03:04,450 --> 00:03:09,160
Then checks of the value on its left is less than the value on its right.
42
00:03:09,400 --> 00:03:13,720
And if that's the case, the result of the condition is going to be true.
43
00:03:13,960 --> 00:03:20,080
We also may have times when we would like to check if the user has done a great job on his last exam.
44
00:03:20,500 --> 00:03:27,400
So probably we are going to check if the grade was, for example, let's say a hundred.
45
00:03:27,880 --> 00:03:31,420
So for that, we are going to use the equals to sign.
46
00:03:31,660 --> 00:03:35,620
Please note that there are two of these signs right here.
47
00:03:36,040 --> 00:03:40,130
And one, they are used this way when they come in despair.
48
00:03:41,110 --> 00:03:46,390
They check the equality between what is on its left side to what is on its right side.
49
00:03:46,630 --> 00:03:53,110
Otherwise, if you wouldn't have used just one of them, then you know that it won't be used to check
50
00:03:53,110 --> 00:03:59,080
any condition, but rather it would simply be an assignment operation like we've seen Prieur in the
51
00:03:59,080 --> 00:04:01,870
previous videos and in the previous section.
52
00:04:02,140 --> 00:04:04,080
So that's an important note, guys.
53
00:04:04,240 --> 00:04:07,900
Please make sure you do not mess around with this.
54
00:04:08,170 --> 00:04:13,270
And here is an example of how to use the equals to logical operator check.
55
00:04:13,600 --> 00:04:15,060
So you use if grade.
56
00:04:15,250 --> 00:04:17,440
Then use the equals to sign.
57
00:04:17,770 --> 00:04:21,620
And you use 80 or a hundred to just check that.
58
00:04:21,670 --> 00:04:24,010
You did grade on your last exam.
59
00:04:24,250 --> 00:04:32,950
And lastly, we also have the not equals to sign this operator as simply means that if we have it as
60
00:04:32,950 --> 00:04:40,960
part of our condition and the value on its left does not equals to the value on its right, then the
61
00:04:40,960 --> 00:04:44,230
result of the condition is going to be true.
62
00:04:44,500 --> 00:04:47,950
The same as equals to just the opposite.
63
00:04:49,060 --> 00:04:54,910
And if you would like to write a condition to make sure that you didn't run out of cash.
64
00:04:55,240 --> 00:04:59,140
Meaning that we don't have a zero to our account.
65
00:04:59,230 --> 00:04:59,990
You should use the.
66
00:05:00,180 --> 00:05:02,920
That equals sign just like this.
67
00:05:03,170 --> 00:05:06,790
And let's hope that these conditions shall always remain true.
68
00:05:07,750 --> 00:05:09,390
Definitely not less then.
69
00:05:09,880 --> 00:05:11,980
Don't let it be less than zero.
70
00:05:12,100 --> 00:05:12,850
That's a problem.
71
00:05:13,120 --> 00:05:13,960
All right.
72
00:05:14,020 --> 00:05:16,330
So this is it for this video.
73
00:05:16,420 --> 00:05:24,340
Now we know water relational operator, seeing how they can be used and now we are ready to move on
74
00:05:24,670 --> 00:05:26,830
to our challenges.
75
00:05:27,190 --> 00:05:28,800
So I'll see you there, guys.
7423
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.