+ 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 ?
3 Respostas
+ 2
7> 7 is false but 7>=7 is true.
got the difference?
+ 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 ... ;-)
+ 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