#1

What distinguishes this code
For example:

Код:
new test1;
new test2;
new qwerty[100];

public OnPlayerSpawn(playerid)
{
if(playerid == 0)
{
SetPlayerPos(....);
SetFacingAngle(....);
SetPlayerInterior(.....);
SetPlayerVirtualWorld(....);
if(...)
{
SendClientMessage(....);
return 1;
}
return 1;
}
else
{
SetPlayerPos(....);
SetFacingAngle(....);
SetPlayerInterior(.....);
SetPlayerVirtualWorld(....);
if(...)
{
SendClientMessage(....);
return 1;
}
return 1;
}
}
From this:


Код:
new test[2], qwerty[100];

public OnPlayerSpawn(playerid)
{
if(playerid == 0)
{
    SetPlayerPos(....);
    SetFacingAngle(....);
    SetPlayerInterior(.....);
    SetPlayerVirtualWorld(....);
    if(...)
    {
        SendClientMessage(....);
    }
}
else
{
    SetPlayerPos(....);
    SetFacingAngle(....);
    SetPlayerInterior(.....);
    SetPlayerVirtualWorld(....);
    if(...)
    {
        SendClientMessage(....);
    }
}
return 1;
}
Does the first example of what a burden or something like that?
Reply
#2

The second one is more readable than the first one, PAWN isn't a language which cares about how much whitespace is in the file but the main point would be that it's readable and doesn't look stupid in this case. Indentation is a good way to help distinguish what is what in the piece of code and well makes it easier to read, and well it looks more clean..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)