1 00:00:01,790 --> 00:00:06,710 The next set of operators will look at are the relational operators, how do things relate together? 2 00:00:08,840 --> 00:00:11,290 So here's another table. 3 00:00:12,170 --> 00:00:18,340 So we have some relational operators that have various symbols which are probably familiar. 4 00:00:19,100 --> 00:00:23,570 So we have a less than symbol which returns all of these. 5 00:00:23,570 --> 00:00:26,030 Return a boolean result, true or false? 6 00:00:26,960 --> 00:00:31,220 So the example that I have here is X less than three. 7 00:00:31,970 --> 00:00:35,390 So if that's true, it's going to return true, otherwise return false. 8 00:00:36,080 --> 00:00:41,090 And the X could be a literal the three could be a variable. 9 00:00:41,510 --> 00:00:42,280 So it doesn't matter. 10 00:00:44,410 --> 00:00:52,810 There's greater than less than or equal greater than or equal equals and not equals, and then something 11 00:00:52,810 --> 00:00:58,390 that most other programming languages don't have is the identity equal and identity not equal. 12 00:00:59,380 --> 00:01:03,040 So what this means, the equal is a double equals sign. 13 00:01:03,310 --> 00:01:06,280 The identity equal is a triple equal sign. 14 00:01:07,240 --> 00:01:12,460 And the identity, the regular equal sign says have X has the value of three. 15 00:01:13,270 --> 00:01:17,590 It's true one JavaScript because of dynamic variables. 16 00:01:18,100 --> 00:01:20,410 X could be a string three. 17 00:01:20,410 --> 00:01:22,420 So quote three quote. 18 00:01:23,020 --> 00:01:23,830 And that returns. 19 00:01:23,830 --> 00:01:29,760 True, but the identity equal says they have to be a equal value and of the same type. 20 00:01:30,760 --> 00:01:35,110 So quote three quote triple equal three is false. 21 00:01:36,560 --> 00:01:40,310 So let's take a look at some examples of using the relational operators. 22 00:01:42,410 --> 00:01:49,500 So once again, I've copied the starter program and let's just start by doing some comparisons. 23 00:01:52,010 --> 00:02:03,080 So we'll start with the literal and we'll say we'll put a little message here is to less than three. 24 00:02:06,900 --> 00:02:10,530 And also to less than three. 25 00:02:12,540 --> 00:02:14,070 All right, so this should be true. 26 00:02:19,050 --> 00:02:20,610 And that log 27 00:02:25,230 --> 00:02:25,430 from. 28 00:02:28,440 --> 00:02:31,830 So two less three is true, makes sense. 29 00:02:32,460 --> 00:02:46,050 So let's come up with an operator and we'll say what upper one equals five and what appear to equals 30 00:02:46,050 --> 00:02:46,520 seven. 31 00:02:47,310 --> 00:02:49,770 So this replaces with opera one, an opera to. 32 00:02:57,910 --> 00:03:05,710 And I'm just going to say no one worse than upward to. 33 00:03:14,510 --> 00:03:17,120 And what I do hear Fred say was that 34 00:03:24,110 --> 00:03:29,390 so again, true, so let's try a couple of the other operators. 35 00:03:32,780 --> 00:03:36,820 So less than or equal should also be true. 36 00:03:38,870 --> 00:03:41,270 Greater than should be false. 37 00:03:42,920 --> 00:03:45,050 Greater than or equal should also be false. 38 00:03:53,220 --> 00:04:02,970 Let's create an opera three and set it also to be five, what's to be the string five? 39 00:04:07,380 --> 00:04:08,400 So 40 00:04:11,250 --> 00:04:14,760 number three, opera three. 41 00:04:23,430 --> 00:04:26,130 And it just changes around a little bit 42 00:04:31,590 --> 00:04:32,010 of 43 00:04:41,790 --> 00:04:42,950 everything look right. 44 00:04:46,740 --> 00:04:54,960 So then we have offer one credit that up three and that comes out is false and that is correct because 45 00:04:54,960 --> 00:04:57,600 it evaluates the number five. 46 00:04:58,580 --> 00:05:05,840 And the string five is numbers, so it's not greater, but upper one is greater than or equal opportunity 47 00:05:05,840 --> 00:05:09,220 that comes out is true because numerically it is true. 48 00:05:11,940 --> 00:05:18,090 So then let's use the equal operator, so Castle, that log 49 00:05:20,790 --> 00:05:26,640 is upper one, double equal to upper three 50 00:05:34,020 --> 00:05:35,670 aspects and capsule's. 51 00:05:43,210 --> 00:05:51,370 And we'll put in the identity one and the identity not equal and do the same thing over here. 52 00:05:51,400 --> 00:05:54,310 I'm going to get a result I'm not expecting. 53 00:06:00,570 --> 00:06:01,270 OK. 54 00:06:05,990 --> 00:06:16,290 So are the same, yes, true, five and string five are the different false, but here the identity 55 00:06:16,290 --> 00:06:24,500 equal becomes false and the not equal identity becomes true because they're not the same type. 56 00:06:29,220 --> 00:06:31,440 So this is an introduction to the relationship. 57 00:06:31,680 --> 00:06:35,130 We're going to find out a lot more about them when we get to conditionals and looping. 58 00:06:36,390 --> 00:06:38,670 Next up, we're going to take a look at logical operators.