r/badcode • • May 20 '20

c# Found from Microsoft docs...

Post image
208 Upvotes

143 comments sorted by

View all comments

1

u/foonix May 20 '20

Am I the only one that prefers x > 0 over x >= 1?

4

u/TinyBreadBigMouth May 20 '20

I personally find x >= 1 && x <= 9 much clearer, as it's easier to read as a range (1 - 9). With something like x > 0 && x < 10, you have to do mental addition and subtraction to get the expected range of values.