What is there utility of '=' sign in relational operators? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is there utility of '=' sign in relational operators?

for example: 7>4 is true and 7>=4 is also true.. so what role is the equal to sign playing ?

27th Feb 2017, 2:53 PM
RAHUL PATIDAR
RAHUL PATIDAR - avatar
3 Answers
+ 2
7> 7 is false but 7>=7 is true. got the difference?
27th Feb 2017, 3:12 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
Just as 'standalone' expressions with literal values, there is no difference. But when you need for example a condition to exit a loop, you will see, what the '>=' means. Some pseudo-code to explain: var = 1 Do [... some code ...] var = var + 1 Loop until var > 4 Changing the last line to: Loop until var >= 4 will make the difference ... ;-)
27th Feb 2017, 3:21 PM
n_OO_b
n_OO_b - avatar
+ 1
1 > 1 - is 1 greater than 1? false 1 >= 1 - is one greater OR EQUAL to 1? true the statement with the equal sign means INCLUDING the number
27th Feb 2017, 3:44 PM
David Koplik
David Koplik - avatar