Trailing or Leading Commas?


For me, it’s leading. If I have a code or syntax problem, I find it easier to see the line missing the comma if I can look at the first char position.

,text or text, ?

Of course you may say that’s crazy, and any reasonable programmer would demand trailing commas. I’m guessing your IDE offers formatting options that allow you to choose what works best for you. A few minutes investing these could save you hours of searching through your code and probably a few headaches.

Most IDEs have way more options than you’ll ever need or investigate. But you look at code all day, often inherited from other less….artful folks. At least make it easier to read.

Related Posts Plugin for WordPress, Blogger...

Similar Posts by Content Area: , ,