0
Why >=50 instead of >49 ?
Wouldn't >49 do the same? Check if a variable is 50 or greater?
11 Réponses
+ 3
It is more precise because it includes the last number as well.
+ 2
Yes, they are equal.
+ 2
i think they are different. because 49.1 greater then 49 but not >= 50
+ 1
So in the end it's more a kind of "personal taste"? :)
+ 1
you use >=50 for precision, if you use >49 a user can key in 49.++ and it will return true
0
Readability.
It depends on what you like to read.
If it's supposed to be less than or equal 10 I'd personally use <= 10 to quickly identify less than 11.
0
yeah
0
I use always use
"< num" and "> num"
instead of
"<= num - 1" and ">= num - 1" respectively for an unknown reason :)
Maybe it's because it makes my code a little more neat compared to the ones with "=" 😂😂
0
matter of readability or aesthetics
0
They are both the same. >= 50 includes 50, it starts from 50 and goes to higher numbers, and > 49 excludes 49, they are higher numbers than 49. you could use either >= 50 or > 49. But the former brings more precision (it's more readable). You're free to use either of them.
0
Basically, those are two different statements when code is translated to assembly.
One is:
JGE (jump if greater/equal >=)
and another is :
JG (jump if greater >).
Multiple IDEs gives you option to check assembly of the code.