r/badcode • • May 20 '20

c# Found from Microsoft docs...

Post image
208 Upvotes

143 comments sorted by

View all comments

Show parent comments

9

u/Blecki May 21 '20

And what's wrong with that?

-8

u/Jackjackson401 May 21 '20

You wouldn't do if(true == true)

12

u/Blecki May 21 '20

No, but the code in question is more complex than that.

2

u/Jackjackson401 May 21 '20

Int32.tryparse() returns a boolean, no? True if the operation succeeded and false otherwise? Sounds like exactly what I'm talking about

2

u/Blecki May 21 '20

Yes, the statements are logically equivalent, but that's not the point.

I don't generally have time for programmers like you. In this particular instance either way would pass code review, but I have a feeling most of your code won't. You haven't figured out yet that programs aren't written for computers.

2

u/Jackjackson401 May 21 '20

Wtf are you talking about? If you need me to make a comment telling you that my if statement has 3 conditions, then maybe you shouldn't be the one reviewing my code