A better way to do this pattern?
#1

So I'm doing this

PHP Code:
for(new 010i++)
{
    
printf("%i"- (((5) * 2) * (5)));
}
 
// output
[00:49:200
[00:49:201
[00:49:202
[00:49:203
[00:49:204
[00:49:205
[00:49:204
[00:49:203
[00:49:202
[00:49:20
I just wanna know if there's a better way to do that.
Reply
#2

You are worrying too much too early. Unless you notice that it's a bottleneck, I would not worry about it. However if you want more readable code, I'd go with
pawn Code:
new
    total = 10,
    peak = total / 2
;

for(new i = 0; i < total; i++)
{
    new j = i;
    if (i >= peak) {
        j = total - i;
    }

    printf("%i", j);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)