View Single Post
  #1  
Old 03-30-2007, 06:41 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Grey View Post
With functions I always use brackets, with statements I tend to omit them if there is only one command by force of habit, but I do usually indent it still and move it to the next line. If there is an else following the if however I always use brackets. Personally I just find it looks a lot nicer that way. As far as spacing goes I agree with HR.

PHP Code:
function checkStyle() {
  if (
this.style == true) {
    
increaseAwesome();
  } else {
    
decreaseAwesome();
  }
  if (
noelse == true)
    
omit true;

PHP Code:
function checkStyle()
{
  if (
this.style)
  {
    
this.increaseAwesome();
  }
    else
  {
    
this.decreaseAwesome();
  }

  if (
this.variable)
  {
    
this.otherVariable true;
  }

Quote:
Originally Posted by Chandler
One to their own I suppose
I guess, however I promote clean styling for a reason: to promote editability, understandability and just overall cleanliness. Leaving brackets out is hardly efficient; say you want to add something later into your conditional code block, you'll then need to add brackets which you could have just done to start with!
__________________
Skyld
Reply With Quote