DEV Community

Discussion on: Simple ways to improve code readability

Collapse
 
jamesthomson profile image
James Thomson

Good tips. I think reading the logic out as a sentence is definitely a great way to realise if it will make sense to others at first glance. If it doesn't read as a proper sentence, then it likely isn't going to easily make sense to others.

Btw, small thing, but item.stock >= 0 should be item.stock > 0 as if the stock = 0 then there is no stock ;)

Collapse
 
briwa profile image
briwa • Edited

Hey, that is true! My mistake. Thanks for correcting me. I've amended the article.