Redim resizes, but does not redimension an array

From Liberty BASIC Family
Jump to navigation Jump to search

Description

If you attempt to use Redim to re dimension an already existing array from single to double dimension or vice versa you will get a compile error.


Example code to demonstrate the bug.


dim a(2)
a(2)=2
print a(2)

redim a(3,3)
a(3,3)=3
y=a(3,3)    'compile fails on attempt to use REDIM'med array
print y


Suggested change to help file text.

REDIM
Description:
This RESIZES an already dimensioned array and clears all elements to zero
(or to an empty string in the case of string arrays). This can be very useful
for writing applications that have data sets of unknown size. If you dimension
arrays that are extra large to make sure you can hold data, but only have a
small set of data, then all the space you reserved is wasted. This hurts
performance, because memory is set aside for the number of elements in
the DIM statement.