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

Of course, you can omit the braces if there’s a single statement (though I personally never do this).


Sure, and you can put the else on the same line as the end of the if block even without doing that. Or you could make the difference bigger by putting the opening brace on a newline.

I wrote the style of C that I actually write, but it's probably not fair for me to label it as a property of just the language.


I think it’s a fair point to bring up given that many people actually do write their code that way.


I agree, I hope I didn't come across otherwise, just wanted to clarify why I wrote it like that.


Or even use allman / gnu where opening braces are also on their own line.


Yes, but those people clearly have issues ;)




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

Search: