Hello and welcome to this lecture.
In this lecture I'm going to explain with a couple of logical operators how that can be used in.
Be Ruby programming language.
These are logical operators that use quite frequently.
There are a lot more logical operators you can use with the Ruby programming language.
I'm just focussing on two in this lecture.
Here's a table of a couple of logical operators.
The first is core.
And.
And this symbol is represented by this two symbol here.
The abassi And we've got the all represented by the pipe symbol the pipe symbol is basically next to
the Z attack on the keyboard.
And reuse in an English keyboard and he's just next to the letter set.
The key to this if you want to get the pipe you call down shift and you just press the button and it
should give you the pipe squat a pipe symbol.
Or let's have a quick look.
Let's go out the example here.
So look at the first.
So got a variable here called X with a value or form another called Y with a value of six so I'm doing
some comparison.
Here I am saying the variable y which is six is less than 10.
That part of it is true and then up 10 and the variable x which has a value of 4 is greater than 1.
So if this were a value it to be true.
So I am comparing two different variables using the and operator which is a logical operator in the
OR.
Example I got a variable y and I'm saying this variable is equal to Phi.
Or the pipes in bombings or x is equal to 3.
So easy to return to force because comparison using the logical operator is wrong.
Why is fix an X is false.
I'm saying why is equal to 5 or x is equal to 3 so boards expressions are wrong.
So it will evaluate to Fort's saw less open aab.
Ah Ruby interpreter.
See how it works.
So I've got my interactive ruby which will interpret a ruby chord for me so I'm just going to create
a couple of varied books.
First would be variable chord X..
I'm going to give you that value of.
For a great unknown variable why I give that value of 6.
So now I'm going to make some comparisons Oh using the logical operator so I'm going to see the value
of y.
Is less than 10 which is true.
And the value of x.
Greater than 1.
So I expect that to evaluate to true as you can see it returned true.
So let's make give you an example.
Using the OR operator.
So I've already defined the variable so I would just say why is he cause to which is double equal to
seek was to 5.
He said no he's not.
And then the pipe symbol of K or x is equal to.
3 that will evaluate to force because X is 4 and why is 6.
So you can see evaluate it to force.
So this is how you basically use the logical operator ant and illogical operate.
Or as you get more into the Ruby programming language.
You get phamily out on how to use these logical operators.
Thanks for watching and bye for now.