HI,

> One more clarification.  If there is an else it should then be
> 
>    if (expresion)
>    {
>       statement;
>    }
>    else
>    {
>       statement;
>    }

Even for single line statements?

I've seen quite a lot of missing braces in if/elses when there only one line. 
I've also seen braces for single line if statements  in the existing code base.

Picking a file I've look at recently (Validator.as) it contains code like this. 
 if (!suppressEvents)
 {
     dispatchEvent(resultEvent);
 }

 if (obj == null)
 {
     //return true;
 }

 if (_trigger)
     return _trigger;
        
  else if (_source)
      return _source as IEventDispatcher;


I particularly like the second example :-) I guess it possible that the braces 
were added after the return true was commented out so not to have the condition 
effect the line below. The blank line in the 3rd example certainly doesn't help 
comprehension of the code.

Justin


Reply via email to