02-21-2023, 05:13 AM
(02-21-2023, 01:07 AM)bplus Wrote: Nope! It is not about using variables for lbound or ubound.
REDIM MyDynamicArray(... ) ' this is dynamic
DIM MyStaticArray(... ) ' this is static
Quiz: How do you reset all values to 0 (or "") in Static Array, how do you do it with Dynamic Array?
If it's static "ERASE" is enough to reset all members.
Cannot do it to a dynamic array unless the programmer is ready to re-allocate it. Otherwise for an array could use a _MEM variable, compute the size of the array extent and use _MEMFILL to set all elements to zero. Need a variable of the same basic type as the array only to set to zero because _MEMFILL requires a reference, cannot be a constant. Might be able to do the same thing with an array of fixed-length strings. Cannot use _MEM toward VLS's so it's harder.
There's always the slow way of using a "FOR... NEXT" loop to set to zero or to the empty string.
Cannot use "CLEAR" because it blanks out all other variables whether or not they are static.