[INFO]Loop
#1

Hello everyone, I could use a function to speed up the various loops?, As well as I did in the forward + public:

Код:
#define function%0(%1) forward%0(%1); public%0(%1)
Код:
function add(a, b) { 
   return a + b;    
}
various loop

Код:
#define Loop(%0,%1) for(new %0; %0 != %1; %0++)
Reply
#2

bumping ?
Reply
#3

Yes, you can.
Reply
#4

Do not bump within 48 hours, learn to read the rules.

And if you would've taken those 1 hour and 16 minutes to actually test it yourself, which would take all of 3 minutes, you'd have your answer.
Reply
#5

if I create a loop with the # define ... how should I do?
Reply
#6

pawn Код:
#define Loop(%0,%1) for(new %0;%0<%1;%0++)
Reply
#7

I asked if I do a for loop as I put it?
Reply
#8

pawn Код:
#define Loop(%0,%0) for(new %0 = 0; %0 < %1; %0++)
//Now you can use it as:
Loop( i, MAX_PLAYERS)
{

}
Reply
#9

There is no difference in using for(new i.. and Loop() because it's just the exact same thing defined.

In order to avoid messy "for(new i=0; i<MAX_PLAYERS; i++)", we define it and use Loop(a, MAX) which looks neat and easier to do.

The real difference could be compared with foreach() by ******.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)