JavaScript:SpiderMonkey:C Coding Style: Difference between revisions

No edit summary
Line 50: Line 50:
* Keep indentation at a minimum.  
* Keep indentation at a minimum.  
** Prefer return statements to cast out abnormal cases, instead of nesting "if/else" statements and indenting the common cases.
** Prefer return statements to cast out abnormal cases, instead of nesting "if/else" statements and indenting the common cases.
  void MyFunction(int n) {
  void
MyFunction(int n)
{
     if (n) {              // bad
     if (n) {              // bad
         ...
         ...
     }
     }
  }
  }
  void MyFunction(int n) {
  void
MyFunction(int n)
{
     if(!n)
     if(!n)
         return;          // OK
         return;          // OK
Confirmed users, Bureaucrats and Sysops emeriti
419

edits