Static i as integer
What will i be before I assign a value.
It seems to be just zero (0) but I wanted to confirm that.
According to Microsoft
Normally in Visual Basic, when a static variable is declared inside a Function or Sub procedure, it gets initialized to 0 (numeric data type) or an empty string, "" (string data type), by default.
So yeah, you can be sure it's default value is zero.
Hope this helps
Variables of all VB data types receive their respective default value when the procedure starts.
This includes initializing all numbers to zero, and all the other data types to their flavour of zero (vbNullString
for strings, not exactly the same as an empty string ""
, False
for booleans, Empty
for variants, and Nothing
for objects).