Makes the specified variable local to a subprogram or function and directs QBasic to preserve the variable’s value between calls.
STATIC
variable[ AS
typename] [, variable[ AS
typename]]…
variable is the name of the variable to make static.
typename is the variable’s type: INTEGER, LONG, SINGLE, DOUBLE, STRING or a user-defined type.
CALL Test
CALL Test
END
SUB Test
STATIC a AS INTEGER
PRINT a
a = a + 1
END SUB
Results in:
0
`