0

Why >=50 instead of >49 ?

Wouldn't >49 do the same? Check if a variable is 50 or greater?

21st Aug 2016, 7:56 PM
Sven Briede
Sven Briede - avatar
11 Respostas
+ 3
It is more precise because it includes the last number as well.
14th Sep 2016, 3:03 PM
Alma Milic
Alma Milic - avatar
+ 2
Yes, they are equal.
22nd Aug 2016, 6:51 PM
Taras
+ 2
i think they are different. because 49.1 greater then 49 but not >= 50
27th Sep 2016, 7:43 AM
Enver SEÇİLMİƞ
+ 1
So in the end it's more a kind of "personal taste"? :)
22nd Aug 2016, 6:52 AM
Sven Briede
Sven Briede - avatar
+ 1
you use >=50 for precision, if you use >49 a user can key in 49.++ and it will return true
22nd Aug 2016, 8:00 AM
Phenias Flint
Phenias Flint - avatar
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.
21st Aug 2016, 10:40 PM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
0
yeah
22nd Aug 2016, 7:28 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
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 "=" 😂😂
22nd Aug 2016, 9:27 PM
Erwin Mesias
Erwin Mesias - avatar
0
matter of readability or aesthetics
2nd Sep 2016, 1:23 AM
Leonardo Espinosa
Leonardo Espinosa - avatar
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.
24th Sep 2016, 10:34 PM
Jephté Extra
Jephté Extra - avatar
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.
31st Oct 2016, 7:15 AM
Mladen Stupar
Mladen Stupar - avatar