SA-MP Forums Archive
Do you pre-bracket? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Do you pre-bracket? (/showthread.php?tid=452243)



Do you pre-bracket? - MP2 - 20.07.2013

No idea what else to call it.

Does anyone else write the brackets first then fill them in? Like so:

pawn Code:
public SomeFunc()
{
    for()
    {
        if()
        {
        }
    }
}
Then write the code between them? I ALWAYS do this, and I don't think I've EVER missed a bracket.


Re: Do you pre-bracket? - saiberfun - 20.07.2013

Quote:
Originally Posted by MP2
View Post
No idea what else to call it.

Does anyone else write the brackets first then fill them in? Like so:

pawn Code:
public SomeFunc()
{
    for()
    {
        if()
        {
        }
    }
}
Then write the code between them? I ALWAYS do this, and I don't think I've EVER missed a bracket.
Using Sublime, so I can follow my brackets if I'd miss one. But yeah I usually do that too.(I only can suggest Sublime, it's "free")


Re: Do you pre-bracket? - DaRk_RaiN - 20.07.2013

Sometimes. When it gets messy or when it's a long boring repeating code.


Re: Do you pre-bracket? - Luis- - 20.07.2013

I usually just do this;
pawn Code:
public Moo() {
    if(CowMoos == true) {
        Cow = 1;
    }
    return 1;
}



Re: Do you pre-bracket? - MP2 - 20.07.2013

Quote:
Originally Posted by Luis-
View Post
I usually just do this;
pawn Code:
public Moo() {
    if(CowMoos == true) {
        Cow = 1;
    }
    return 1;
}
I fucking hate that indentation style. It makes your code really messy and unreadable.. I much prefer having my brackets aligned.


Re: Do you pre-bracket? - DaRk_RaiN - 20.07.2013

Quote:
Originally Posted by MP2
View Post
I fucking hate that indentation style. It makes your code really messy and unreadable.. I much prefer having my brackets aligned.
That's K&R style, and yes I also like to use Allman Style.
EDIT:
This is somewhat useful.
http://forum.sa-mp.com/showthread.ph...beautiful+read


Re: Do you pre-bracket? - thefatshizms - 20.07.2013

Most of the time, yes

I use K&R style most of the time.. I put spaces between the previous statement so it is readable

pawn Code:
if(condition) {

    //do this shizzel
    DoShizzel();
}



Re: Do you pre-bracket? - SchurmanCQC - 20.07.2013

Quote:
Originally Posted by MP2
View Post
I fucking hate that indentation style. It makes your code really messy and unreadable.. I much prefer having my brackets aligned.
I believe there's actually proper etiquette for these languages. Entirely unsure though.

When I'm using Visual Studio to code in winJS (Java Script for Windows, Windows 8 apps) it automatically corrects my brackets to Luis' method.

pawn Code:
public Moo() {
    if(CowMoos == true) {
        Cow = 1;
    }
    return 1;
}
When I'm coding in C#, it automatically corrects my brackets to your method.

pawn Code:
public Moo()
{
    if(CowMoos == true)
    {
        Cow = 1;
    }
    return 1;
}



Re: Do you pre-bracket? - Luis- - 20.07.2013

Quote:
Originally Posted by MP2
View Post
I fucking hate that indentation style. It makes your code really messy and unreadable.. I much prefer having my brackets aligned.
People are different, I feel it makes my codes a lot smaller.


Re: Do you pre-bracket? - SuperViper - 21.07.2013

Quote:
Originally Posted by Luis-
View Post
People are different, I feel it makes my codes a lot smaller.
I used to do it in Java but then I got used to the new method and it worked out a lot better for me. The brackets are aligned now and Sublime Text draws a vertical line down to the matching bracket which really helps even though I never miss a bracket since I pre-bracket.