Journal
Monday April 28, 2003
Embracing curly braces
I read somewhere that curly braces are a good thing, even in cases where they are unnecessary. For example,
return true;
return true;
}
|
Comments
I have always used curly braces as in the second example. When I come across code written like the first example, I find it near-impossible to understand. imo having the scope clearly defined is neater as well as more robust. Posted by: plusplus at May 1, 2003 10:59 PMGood on ya! Clean and proper code always reads nicer for those who have to work with it, even the computer. Okay... so the computer doesn't care... but one day they might! Watch out! Posted by: sugarjunky at May 9, 2003 04:18 AMCurly braces are good, though I'm not a fan of the opening one being at the end of the code line, personally I prefer: function foo() I find it easier to glance at the code to see the 'level' of the contained code. Indenting is also a good thing, though best with Tabs, not spaces :) Posted by: Zingo at May 12, 2003 04:51 AM
Post a comment
|
