Hacker News new | ask | show | jobs
by OtherShrezzing 842 days ago
> if (disableCommentsRanking.enabled == False)

This could use some light-touch code reviewing

3 comments

Because the HN crowd likes learning new things: if `enabled` is a nullable boolean in C# (i.e. has type `bool?`) then this check must indeed be written this way, to avoid confusing null with false.
I thought OP meant to imply that the readability could use some tweaking. You have 'disable', 'enabled' and 'False' used in the same expression so it requires some (more) thinking while reading it and trying to decipher what it's trying to do.
That is a more fundamental and better criticism that I'm embarrassed I overlooked.
Some could argue it would be for illustration purpose, and not actual production code
It looks funny, but I think it's actually good, and arguably the best possible form of it.