I am very fussy about the format of my code, extremely. Back in the days when ASP was a new web technology I would litterly spend hours making sure the autogenerated code fom my asp page was properly indented in the source view of the browser. Whenever I would inherit code from a co-worker I had to make sure the format was right so I could work on it. This obsession has never gone away, to this day the format of stuff still bugs the hell out of me. Recently, I have been reading Mootools-Core just so I could get a better understanding of what goes on under the hood. Anyway, the style of the source files is gorgeous, but it raised a question in my mind concerning if statements. What statement is formatted properly from the following statements:

if (a == b) doSomething
else doSomethingElse

as opposed to:

if (a == b){
     doSomething
} else {
    doSomethingElse
}

as opposed to:

if (a == b)
{
     doSomething
} else
{
    doSomethingElse
}

as opposed to:

if (a == b)
    doSomething
else
    doSomethingElse

as opposed to:

if (a == b) doSomething else doSomethingElse

I have seen them done every one of these ways, I guess what i'm asking is this style up to interpretation or what would be more standard?

Reply via email to