if statements with arrays
#1

I have this variable with arrays of 17 cells, i want to put it as statement:
Instead of if(TollGate[0] || TollGate[1] || TollGate[2] || TollGate[3] etc till 16....)
How to make it shorter, in one word / array and to check all the arrays in one time...

new TollGate[16];

Thanks.
Reply
#2

pawn Код:
for(new i; i < sizeof(TollGate); i++)
{
    if(/*something*/ == TollGate[i])
    {
        // Do stuff
        break;
    }
}
Reply
#3

pawn Код:
for(new i = 0; i < 16; i++) if(TollGate[i]) // do your stuff and break;
edit: vince won.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)