' Array search and sort
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL arr(10) AS LONG
    LOCAL i AS LONG
    LOCAL j AS LONG
    LOCAL t AS LONG
    arr(0)=5:arr(1)=3:arr(2)=8:arr(3)=1:arr(4)=9
    arr(5)=2:arr(6)=7:arr(7)=4:arr(8)=6:arr(9)=0
    FOR i = 0 TO 8
        FOR j = i+1 TO 9
            IF arr(i) > arr(j) THEN t=arr(i):arr(i)=arr(j):arr(j)=t
        NEXT j
    NEXT i
    FOR i = 0 TO 9
        PRINT STR$(arr(i))
    NEXT i
    PRINT "Done."
    FUNCTION = 0
END FUNCTION
