1 00:00:00,750 --> 00:00:03,030 Hello and welcome to this lecture. 2 00:00:03,110 --> 00:00:11,900 In this lecture I'm going to explain with a couple of logical operators how that can be used in. 3 00:00:11,940 --> 00:00:14,180 Be Ruby programming language. 4 00:00:14,520 --> 00:00:19,690 These are logical operators that use quite frequently. 5 00:00:19,800 --> 00:00:24,700 There are a lot more logical operators you can use with the Ruby programming language. 6 00:00:24,720 --> 00:00:28,910 I'm just focussing on two in this lecture. 7 00:00:29,580 --> 00:00:35,030 Here's a table of a couple of logical operators. 8 00:00:35,040 --> 00:00:36,600 The first is core. 9 00:00:36,640 --> 00:00:37,140 And. 10 00:00:37,180 --> 00:00:42,390 And this symbol is represented by this two symbol here. 11 00:00:42,400 --> 00:00:50,130 The abassi And we've got the all represented by the pipe symbol the pipe symbol is basically next to 12 00:00:50,160 --> 00:00:53,580 the Z attack on the keyboard. 13 00:00:53,860 --> 00:00:59,330 And reuse in an English keyboard and he's just next to the letter set. 14 00:00:59,370 --> 00:01:05,850 The key to this if you want to get the pipe you call down shift and you just press the button and it 15 00:01:05,850 --> 00:01:10,360 should give you the pipe squat a pipe symbol. 16 00:01:10,720 --> 00:01:12,660 Or let's have a quick look. 17 00:01:12,660 --> 00:01:15,050 Let's go out the example here. 18 00:01:15,480 --> 00:01:18,660 So look at the first. 19 00:01:18,950 --> 00:01:27,210 So got a variable here called X with a value or form another called Y with a value of six so I'm doing 20 00:01:27,210 --> 00:01:28,350 some comparison. 21 00:01:28,350 --> 00:01:34,320 Here I am saying the variable y which is six is less than 10. 22 00:01:34,380 --> 00:01:45,530 That part of it is true and then up 10 and the variable x which has a value of 4 is greater than 1. 23 00:01:45,750 --> 00:01:48,060 So if this were a value it to be true. 24 00:01:48,270 --> 00:01:58,290 So I am comparing two different variables using the and operator which is a logical operator in the 25 00:01:58,350 --> 00:01:58,730 OR. 26 00:01:58,770 --> 00:02:07,620 Example I got a variable y and I'm saying this variable is equal to Phi. 27 00:02:09,090 --> 00:02:15,200 Or the pipes in bombings or x is equal to 3. 28 00:02:15,450 --> 00:02:22,410 So easy to return to force because comparison using the logical operator is wrong. 29 00:02:22,780 --> 00:02:26,840 Why is fix an X is false. 30 00:02:26,840 --> 00:02:34,080 I'm saying why is equal to 5 or x is equal to 3 so boards expressions are wrong. 31 00:02:34,110 --> 00:02:38,900 So it will evaluate to Fort's saw less open aab. 32 00:02:38,920 --> 00:02:42,530 Ah Ruby interpreter. 33 00:02:43,170 --> 00:02:44,690 See how it works. 34 00:02:44,730 --> 00:02:52,620 So I've got my interactive ruby which will interpret a ruby chord for me so I'm just going to create 35 00:02:52,710 --> 00:02:54,150 a couple of varied books. 36 00:02:54,150 --> 00:02:56,870 First would be variable chord X.. 37 00:02:57,120 --> 00:03:00,400 I'm going to give you that value of. 38 00:03:01,050 --> 00:03:09,620 For a great unknown variable why I give that value of 6. 39 00:03:09,780 --> 00:03:17,610 So now I'm going to make some comparisons Oh using the logical operator so I'm going to see the value 40 00:03:17,700 --> 00:03:19,180 of y. 41 00:03:20,700 --> 00:03:25,990 Is less than 10 which is true. 42 00:03:27,910 --> 00:03:32,990 And the value of x. 43 00:03:34,680 --> 00:03:37,880 Greater than 1. 44 00:03:38,080 --> 00:03:45,380 So I expect that to evaluate to true as you can see it returned true. 45 00:03:45,560 --> 00:03:48,130 So let's make give you an example. 46 00:03:48,160 --> 00:03:50,850 Using the OR operator. 47 00:03:51,280 --> 00:04:01,120 So I've already defined the variable so I would just say why is he cause to which is double equal to 48 00:04:01,960 --> 00:04:04,830 seek was to 5. 49 00:04:05,530 --> 00:04:07,390 He said no he's not. 50 00:04:07,640 --> 00:04:17,250 And then the pipe symbol of K or x is equal to. 51 00:04:18,400 --> 00:04:26,670 3 that will evaluate to force because X is 4 and why is 6. 52 00:04:26,800 --> 00:04:30,040 So you can see evaluate it to force. 53 00:04:30,250 --> 00:04:36,970 So this is how you basically use the logical operator ant and illogical operate. 54 00:04:37,030 --> 00:04:43,260 Or as you get more into the Ruby programming language. 55 00:04:43,420 --> 00:04:49,170 You get phamily out on how to use these logical operators. 56 00:04:49,180 --> 00:04:51,350 Thanks for watching and bye for now.