Hello,
I have a small and possibly dumb question. Before i came hear i read the part where it explains about static variables in the pawn language guide, but still i couldn't find an answer to my question.
Let's say i have this line:
PHP Code:
MyFunction( ) {
static iVariable = 5;
// stuff here
}
In C++, AFAIK, the first time that function is called, iVariable is set to 5, but when any other time that function is called, it is not re-initialized to 5, it's current value stay the same. Let me make things clear with an example.
Let's say inside that function i changed the value of iVariable like the following:
PHP Code:
MyFunction( ) {
static iVariable = 5;
// stuff here
iVariable += 1;
// stuff here
}
The first time the function is called, iVariable is created and set to 5. Then iVariable becomes 6. But then at the second call of the function, iVariable is not reset to 5, but it's value remains 6, therefore after the function ended, it's value becomes 7. That is in C++.
My question is, does that scenario applies to pawn as well?
If i wasn't completely clear, please tell me and i will explain in another way if possible.
EDIT: nvm tested it and the scenario still applies. I have no idea why i didn't test it before.
Regards,
n0br41ner
__________________