> I may or may not know what I'm talking about today.
Dammit! I was just about to use that as my signature. Now I have to come up with something else. Too bad Steve is busy!
Yes, there is some interesting behavior in subs. For example...
Also, as a slightly related side note, CLEAR removes the initialization of dynamic arrays, but not a static ones, but CLEAR cannot be used in a sub.
Pete
Dammit! I was just about to use that as my signature. Now I have to come up with something else. Too bad Steve is busy!
Yes, there is some interesting behavior in subs. For example...
Code: (Select All)
CALL pete
a(5) = 7
PRINT "a(5) back in main:"; a(5) ' This works. An un-passed un-shared dynamic array in a sub had the initialization maintained.
REDIM b(10) ' Dynamic array in the main.
b(5) = 3
PRINT "b(5) in Pete sub:"; b(5)
ERASE b
PRINT "b(5) after ERASE is non-existent."
PRINT "See? We now get a subscript out of range error at the next line..."
b(5) = 7 ' Errors out. This dynamic array in the main was de-initialized, as expected.
SUB pete
REDIM a(10) ' Dynamic array in a sub.
a(5) = 3
PRINT "a(5) in Pete sub:"; a(5)
ERASE a
PRINT "a(5) after ERASE is non-existent."
END SUB
Also, as a slightly related side note, CLEAR removes the initialization of dynamic arrays, but not a static ones, but CLEAR cannot be used in a sub.
Pete
Shoot first and shoot people who ask questions, later.