• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] static const help
#4
Yes, you can.

local static: When using 'static' on a lower level (like you did) it's value will be remembered.
Code:
myCode()
{
    for (new i; i < 10; i)
    {
        static x;
        x;
        printf("%i", x);
    }
}
This would print "1" up to "10". If you would use "new x;" it would print "1" 10 times.

global static: When using 'static' on highest level (outside any function, eg. near your includes) it means that variable may only be used in that file.

const: constant. When declaring a variable as a constant it cannot be altered. Eg. if you'd try to use format() or simply setting the value of your string in your example, it would not compile.
  Reply


Messages In This Thread
static const help - by Zow - 2021-06-15, 03:15 PM
RE: static const help - by Pinch - 2021-06-15, 05:04 PM
RE: static const help - by Zow - 2021-06-15, 09:17 PM
RE: static const help - by Kwarde - 2021-06-15, 11:36 PM

Forum Jump: