25.09.2010, 00:12
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:
normal indentation:

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;
}
}
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;
}
}

