Linux - Relational operators
Nov 28, 2024
Linux - Relational operators
View Video Transcript
0:00
now Here I am going to explore your
0:02
relational operators so arithmetical
0:04
operators we have already used now we
0:07
are going to use relational operators
0:09
for a game for the variables all the
0:11
particular programs which we are going
0:13
to create later on by using this values
0:15
so let us check what are the operators
0:18
we do have into the relational operators
0:19
now very first you have - EQ it act as
0:23
same as your operator equals 2 that
0:25
means it is going to check whether it is
0:27
equal or not but in spite of using
0:30
double equals 2 I'll be using - EQ
0:33
between check your variable a is equal
0:36
to your variable B or not same thing if
0:40
the condition become true it will give
0:42
you a true value if not it will give you
0:44
a false value then you have an e that is
0:47
not equal to so we can also set in spite
0:51
of your a naught that is exclamation
0:54
equals 2 in spite of that I can also
0:56
define - and E that again provide me
0:59
this same output then you have - GT that
1:02
is greater than if I want to check
1:04
whether my a is greater than B or not I
1:07
can also check by using - GT same way I
1:10
can use LT for less than or not I can
1:14
check whether my a value is less than or
1:16
not your P so if it is less than they B
1:20
it will give you a true value not so it
1:22
will give you your first value the next
1:24
we have that is GE again it will provide
1:27
you a greater than or not so that
1:31
particular value will be provided by a
1:32
equals to GE then your B then we have le
1:37
that is again the left operand is less
1:39
than or your right hand operand or not
1:42
so same way Lari will e is less than
1:45
your V or not so again we can use such
1:49
kind of relational operators while we
1:51
are adding the command so it will reduce
1:52
using the automaticall operator it can
1:55
provide you the facilities to check
1:57
whether this operators are greater than
1:58
or less than the existing variable or
2:02
not so let us check how we can use this
2:05
relational operators into our program so
2:08
here we can check into one of my loop
2:11
this is the first
2:14
where I've used the iff iff segment and
2:18
I FIF statements will also provide you
2:21
the what kind of your Lopez so it is
2:24
if-else kind of statement like I have
2:26
defined it over here to fetch a
2:29
particular value from the user and store
2:32
it into the variable a same way fetch
2:35
the second member from the user and
2:37
fetched in 2d and storage annuity value
2:40
P now if we have done that now if come
2:43
on if the condition we are setting like
2:45
if this value a is equal to value B then
2:49
we should get an message that both
2:52
values are equal so I have just used the
2:54
relational operator who are here that is
2:56
equal so here it is giving you this same
3:00
message if the value is true if it is
3:03
false so what it will do it will
3:04
directly give you the value that this
3:07
values are not equal to with each other
3:10
let us check with this so I've just
3:13
saved a file here I'm going to run the
3:15
file by using as such command so as such
3:17
role I have got a set and you can see it
3:20
is asking me for the first number I'm
3:22
going to define the first number as 2
3:24
second number as 3 so it's showing me
3:27
both values are not equal same way if I
3:31
run the same show and if I give two at
3:36
the first value and again to a second
3:38
value it will show me both are equal
3:40
this way I have defined the complete
3:43
relational operators into the if
3:45
conditions because when you are talking
3:47
about the relational operators means
3:48
they are having some relations with the
3:50
other operators and when we are defining
3:52
the condition we cannot define it
3:53
directly a variable we need to use it
3:56
into some of the loops or where we
3:58
define the conditions in the cases or in
4:01
the statements so this is how generally
4:03
I have used the relational statement so
4:06
you can use it and modify it in two
4:09
different relational statements you have
4:10
like less than equal to you can define
4:13
any one of it right so this is what
4:15
exactly we have seen how we can use the
4:17
relational operators into your shell so
4:20
you can see the whole complete process
4:22
is happening just because of this
4:23
relational operator this is going to
4:25
check the condition or
4:27
porty variables this were the relation
4:29
of woody variables whether they are
4:31
equal or not by using this EQ so this is
4:36
what exactly we have seen how we can use
4:38
the relational operators into the
4:40
if-else statement so if I want to use
4:43
the same other operators I'll be using
4:44
again the if condition and where I'll be
4:47
defining the variables and the values
4:49
let us check into the next video where
4:52
we are going to see about the boolean
4:54
operators
#Computer Science
#Programming
#Software

