Problem

It is to alphabetize a given array variable in ascending order.

Script

DIM t[], s[]

! ### set source

t[1]="one "
t[2]="two "
t[3]="three "
t[4]="four "

! ### preset destination (for strings only)
FOR i=1 TO VARDIM1(t)
 s[i]=""
 NEXT i

! ### sort t[…] into s[…]
FOR i=1 TO VARDIM1(t)
 p=i
 FOR j=1 TO i-1
  IF s[j]>t[i] THEN
   ! insert element
   FOR k=i TO j+1 STEP -1
    s[k]=s[k-1]
    NEXT k
   p=j : j=i-1
   ENDIF
  NEXT j
 s[p]=t[i]
 NEXT i

! ### output
PRINT s, " • dimension:", VARDIM1(s)