Simple Question.
#9

Indentation is mostly for the overview. If you got large scripts with lots of functions and ifs, and you do not indent them, you will experience a great fail when searching for something

But if you indent correctly, you can easily differ what part of the code belongs to a specific 'if' or 'else'

a small Example, Im sure you will see the differecne
no indentation:
pawn Код:
for(new i = 0; i < INV_slots_allowed[playerid]; i ++) {
if(pInventory[playerid][i][ItemID] == INVALID_ITEM_ID) {
format(text, sizeof(text), "%s - Empty space -\r\n", text);
count += 2;
} else {
format(text, sizeof(text), "%s%s - Amount: %d\r\n", text, name, amount);
count += 3;
}
}
normal indentation:
pawn Код:
for(new i = 0; i < INV_slots_allowed[playerid]; i ++)
{
    if(pInventory[playerid][i][ItemID] == INVALID_ITEM_ID)
    {
        format(text, sizeof(text), "%s - Empty space -\r\n", text);
        count += 2;
    } else
    {
        format(text, sizeof(text), "%s%s - Amount: %d\r\n", text, name, amount);
        count += 3;
    }
}
Reply


Messages In This Thread
Simple Question. - by Tee - 24.09.2010, 23:08
Re: Simple Question. - by willsuckformoney - 24.09.2010, 23:15
Re: Simple Question. - by Tee - 24.09.2010, 23:20
Re: Simple Question. - by willsuckformoney - 24.09.2010, 23:32
Re: Simple Question. - by willsuckformoney - 24.09.2010, 23:39
Re: Simple Question. - by Tee - 24.09.2010, 23:43
Re: Simple Question. - by LarzI - 24.09.2010, 23:44
Re: Simple Question. - by Tee - 24.09.2010, 23:46
Re: Simple Question. - by Mauzen - 25.09.2010, 00:12

Forum Jump:


Users browsing this thread: 1 Guest(s)