• Create Account

### #Actualstitchs

Posted 15 April 2013 - 02:29 PM

The first style is my personal preference aswell. And for the reason you mentioned, it makes everything a bit clearer, adds that extra spacing between lines, and allows quick identification of which braces are paired, and where nesting occurs.

I did dabble in the second type, when I thought less lines = the way to go! But after a while it became a slight headache. Again, it's personal preference to the coder and one persons style may not suit another. But, think about people reading it later, I want them to be able to read it as clearly and concisely as possible.

There is also the usage of no braces being used. This occurs if an 'if' statement is only intended to trigger 1 function.

if(someClauseIsTrue)
fireThisFunction();

I also used to do this, but again, it becomes a bit of a headache when you quickly skim it.

Regards,

Stitchs.

### #1stitchs

Posted 15 April 2013 - 02:29 PM

The first style is my personal preference aswell. And for the reason you mentioned, it makes everything a bit clearer, adds that extra spacing between lines, and allows quick identification of which braces are paired, and where nesting occurs.

I did dabble in the second type, when I thought less lines = the way to go! But after a while it became a slight headache. Again, it's personal preference to the coder and one persons style may not suit another. But, think about people reading it later, I want them to be able to read it as clearly and concisely as possible.

There is also the usage of no braces being used. This occurs if an 'if' statement is only intended to trigger 1 function.

if(someClauseIsTrue)
fireThisFunction();


I also used to do this, but again, it becomes a bit of a headache when you quickly skim it.

Regards,

Stitchs.

PARTNERS