DEF RESIZE ARRAY,SIZE WHILE LEN(ARRAY)>SIZE && ""*POP(ARRAY):WEND COPY ARRAY,SIZE,ARRAY,0 ENDExample usage:
DIM A[10] ?LEN(A) RESIZE A,3 ?LEN(A) RESIZE A,27 ?LEN(A)
Root / Submissions / [.]
DEF RESIZE ARRAY,SIZE WHILE LEN(ARRAY)>SIZE && ""*POP(ARRAY):WEND COPY ARRAY,SIZE,ARRAY,0 ENDExample usage:
DIM A[10] ?LEN(A) RESIZE A,3 ?LEN(A) RESIZE A,27 ?LEN(A)
DEF RESIZE(A,S) DIM NEW[S] COPY NEW,A,S RETURN A END DIM TEST[10] TEST=RESIZE(TEST,3)(Plus you'd need separate functions for int/float/string arrays) Which works fine (and is probably faster) in many situations, but, for example, in a function that modifies arrays in-place, it won't work.