Kinda useless question
#1

Why do some scripters put ALOT of spaces in their code? xD, I always wanted to know that!
Reply
#2

What do you mean?
Reply
#3

Its called indentation and it makes the code easier to read and it looks better.
Reply
#4

Quote:
Originally Posted by Finn
Посмотреть сообщение
What do you mean?
Some people do like this:
pawn Код:
if ( sscanf ( params, "u", id ) )
    return SendClientMessage ( playerid, 0xAAAAAA, "Message" );
That's what I wanted to ask, why so much spaces? It makes the line LONG, and you can get error for "input line too long" if you do a long line...
I prefer no un-needed spaces like this:
pawn Код:
if(sscanf(params, "u", id))
    return SendClientMessage(playerid, 0xAAAAAA, "Message");
Reply
#5

It's easy to read, looks neater to me also, I format my code always like that when I'm writing a samp script. When I write something for c# or c++ (visual IDE) I don't as it formats for me but when writing some code in an editor which doesn't auto format then it will look like that.

It's just a style like indentation, everyone has thier own, like you put spaces between your parameters.
Reply
#6

Quote:
Originally Posted by Donny_k
Посмотреть сообщение
It's easy to read, looks neater to me also, I format my code always like that when I'm writing a samp script. When I write something for c# or c++ (visual IDE) I don't as it formats for me but when writing some code in an editor which doesn't auto format then it will look like that.

It's just a style like indentation, everyone has thier own, like you put spaces between your parameters.
That's 100% my opinion. It's just the same thing with the brackets

pawn Код:
if(ble==1){
...
}
and
pawn Код:
if(ble==2)
{
...
}
does not matter which you use, but everyone uses his own style. I like the version with less spaces and the bracket directly behind the if-statement, which is the most common way of scripting, i guess, due to the fact, that it is the fastest one (which i know), although I began with putting the bracket into a new line, which makes it harder for me to now switch over to the, in my opinion better style.
Reply
#7

I much rather have the second one. I then have a good overview of the brackets and can see if I am missing one (open or close resp)
Reply
#8

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
I much rather have the second one. I then have a good overview of the brackets and can see if I am missing one (open or close resp)
Yea i like it more for the readability. And since i do that much indentation, i do not count lines. I do not believe more lines = a good script. Neither does less lines = a good script
Reply
#9

I'm definitely someone who likes to compact code as much as possible.
Usually it's just more convenient for me, as I hardly ever use the mouse, so using arrow keys when I need to fix something becomes a pain when you're going past 800 spaces in one line.
Reply
#10

Well, abt the brackets, I put them in a new line, it's easier to find a missing bracket then.
Compare this
pawn Код:
public Something(sthing) {
    for(new i; i < MAX_PLAYERS; i++) {
        DoSomethin
    }
    return true;
}
It's easier to find a missing bracket like this:
pawn Код:
public Something(sthing)
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        DoSomethin
    }
    return true;
}
Isn't it?

Abt the spaces, I might start scripting with spaces. LoL!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)