PropBasic: Default VAR value in sub
VonSzarvas
Posts: 3,525
In a sub, a VAR defined thus:
...will only be "default" set to 100 once (defined globally rather than in the sub)
Thus, if the same sub is called multiple times, the timeout/VAR does not reset each time to default value (100 in this example).
Is this by design?
Should I have already read about this "gotcha" somewhere? - Forgive me if I should have done:)
Might it be better for the compiler to interpret such SUB/FUNC code as:
?
Not sure, but that might be what the feature intended?
timeout VAR Long = 100
...will only be "default" set to 100 once (defined globally rather than in the sub)
Thus, if the same sub is called multiple times, the timeout/VAR does not reset each time to default value (100 in this example).
Is this by design?
Should I have already read about this "gotcha" somewhere? - Forgive me if I should have done:)
Might it be better for the compiler to interpret such SUB/FUNC code as:
timeout VAR Long timeout = 100
?
Not sure, but that might be what the feature intended?