Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My standard approach is to only ever omit the braces when the entire if statement fits on a single line. I also enforce a hard 80-char limit on my lines, which prevents a single enormous line.


I personally hate an 80 character limit. I do wrap comments at 80 or 100 chars but code isn't read like english prose--It's very easy to read a long line of code and it makes a lot of sense (sometimes) to keep everything on one line. Especially if there are multiple similar lines where you can make the columns line up nicely.


I personally find that the limit means that you're not occasionally reading far away from the main body of code, which makes it easier for my eyes to track. An added bonus is the ability to put multiple files side-by-side, something not easily possible when lines can be of arbitrary length.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: