Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
canacrypto
· 7y ago · 0 comments
I've found it's better to write normal conditions that are easier to read and leave it to your linter to catch unintended assignments.
Comments
[–]
thomasahle
7y ago
Are they really easier to read though? A lot of the time which variable being tested is obvious, so it makes sense to put the important information - the value - first.
[–]
jonny_eh
7y ago
> so it makes sense to put the important information
Both sides of the equality check are equally important.
[–]
TheSoftwareGuy
7y ago
I think he should have written "it makes sense to put the non-obvious information first" as it contrasts better with the first part of the sentence