Wondering about something, just out of curiosity.
#3

Quote:
Originally Posted by Hiddos
View Post
That's a bump hehe, guess it's allowed now.

I also wondered about something different: When should I use "new" variables and when should I use "static" ones?

I already had this timer idea:

pawn Code:
//stuff
But now I'm just wondering if this is correct usage for it or not ^^
Well it really depends on what your variable stores. The difference between "new" and "static" is that static retains its value when used in a function. When the function ends, the variables value is still existent. So if you have:

Code:
static test = 5;
test++;
in a function, and you call that function 3 times, your results will be 8 instead of it being 6.


EDIT:

Oh yeah, when you assign a value to the static variable while initializing it, that assignment only happens that one time :P.


As for your first post: No. The stringize operator is very literal, if you do something like #var it will add "var" into the string, instead of the value.
Reply


Messages In This Thread
Wondering about something, just out of curiosity. - by Hiddos - 17.09.2010, 18:39
Re: Wondering about something, just out of curiosity. - by Hiddos - 18.09.2010, 12:49
Re: Wondering about something, just out of curiosity. - by Kyosaur - 18.09.2010, 13:01
Re: Wondering about something, just out of curiosity. - by Hiddos - 18.09.2010, 13:04
Re: Wondering about something, just out of curiosity. - by Kyosaur - 18.09.2010, 13:08

Forum Jump:


Users browsing this thread: 1 Guest(s)