Hello and welcome to this lecture.
In this picture are be covering in some comparison operators that can be used with the Ruby programming
language.
I've got a table here of some comparison operators.
I'm just going to quickly run through them with you.
The first on the list here is the sequence two and the symbol for that is the double.
Because to see if you want to compare values you see Frank they have a variable here called X which
it's got the value of four and a variable y which is got a value of six.
So you can do comparison between the two values.
So I can see X double equals to men.
You are comparing.
Here's I think you've got just a single equals two.
It means you are signing in value that is here is a single IT WAS TO is used to assign values while
double is used to compare.
So what I'm saying is that is X equals to Y.
The answer is force is for us on the fourth value because X is not equal to Y.
Here will be not equal sign.
And this is the symbol so X has a value or for y value of 6.
And here with same why is not equal to x which is true.
Can wait 6 an X is 4.
We've got another comparison.
Nothing's greater.
So here we go.
Variable x which is 4 and a wide variable which is 6 is saying is X greater done Y.
No it is not science's but it will return force of course.
X is for and y.
If the next We've got the less than comparison so X is for y is x is x leston Y.
Yes.
Well evaluate to be true.
Of course it is for and why.
6.
And this is the symbol for less than side.
So you can also have the greater than or equal to.
Which means in value your comparing was either be greater than or equal to.
For example here.
Value x 4 and Y variable is 6 is the expression.
Here is.
That is why is greater than or equal to x.
That is true call y his 6 X is false or why he is greater than x so he will evaluate to be true.
On the other spectrum we've got less than not equal to x is 4.
Why is 6 the expression here in X is less than or equal as to why.
Which is true cause X is for y is sixth.
So let's open up our interactive Ruby.
Play around with some of these values.
The first thing I want to do is find a variable.
I am going to define a variable x.
I am going to set that to 4 give you the value for our create and then a variable y.
I'll give you the value of fix.
So what variables have been created.
You can really use them over and over again unless you change the value.
So the first comparison I'm going to do is I want to check if one variable is equal to the other.
And you do that with a double equals to sign.
So I want to see x is equal to you use a double equates to why X is 4 and why it is 6 so I expect this
to return in value or force.
So there you go.
It has returned force.
Also I can check if a value is not equal to something so I can see why no y value of y is 6.
So I can see why it is not equal to x.
Okay call y is fix an X is forswore.
This also we evaluate to true you are because the expression is right.
Y.
He is 6 X's for less two is greater than comparison.
So if I see x is x greater than y.
No.
This return force is why greater than x this we're in this will return true because why is greater then
right.
So little less than is X
less than Y that we valued to be true.
Okay.
There's too great a dan or even Also too.
So here's why greater than an equals to X that we again value it to be true or Y is greater than x.
We'll do one more we'll do a less down this time.
So we say is X less than or equal as to why that's valid too true because X is less than Y.
So these are some basic comparison operators that can be used in the Ruby programming language.
Many thanks for watching and bye for now.