Okay, so when I first was learning programming, I learned to create code blocks with the curly bracket on the starting line, like so:
But since I've been using Torque Game Builder and coding in TorqueScript, the standard practice is to open the block of code on a new line so that the opening and closing brackets are lined up:
That's fine and all, and I've successfully made the transition in coding style, and this topic isn't really about the personal preference of where to put the opening bracket of a code block. The question really is, how does this style work when immediately opening up another block of code, for example from an else statement? This is how it seems natural to me, coming from my background putting the bracket on the same line as the code that indicates I'm about to open a block of code (see line 4 below).
But if I'm trying to stay consistent with putting opening brackets on a new line, should I do it like this?
But then that looks weird, so should it be
But then the else looks strange all by its self.
I'm confused... Any tips and reasons on the "proper" or "best" way to handle this?
Code: (actionscript)
function myFunction() {
// multiple lines of code here
}But since I've been using Torque Game Builder and coding in TorqueScript, the standard practice is to open the block of code on a new line so that the opening and closing brackets are lined up:
Code: (actionscript)
function myFunction()
{
// multiple lines of code here
}That's fine and all, and I've successfully made the transition in coding style, and this topic isn't really about the personal preference of where to put the opening bracket of a code block. The question really is, how does this style work when immediately opening up another block of code, for example from an else statement? This is how it seems natural to me, coming from my background putting the bracket on the same line as the code that indicates I'm about to open a block of code (see line 4 below).
Code: (actionscript)
if (statement)
{
// multiple lines of code here
} else {
// multiple lines of code here
}But if I'm trying to stay consistent with putting opening brackets on a new line, should I do it like this?
Code: (actionscript)
if (statement)
{
// multiple lines of code here
} else
{
// multiple lines of code here
}But then that looks weird, so should it be
Code: (actionscript)
if (statement)
{
// multiple lines of code here
}
else
{
// multiple lines of code here
}But then the else looks strange all by its self.
I'm confused... Any tips and reasons on the "proper" or "best" way to handle this?





















).

