Here is the code, it takes 5 names and alphabetizes them. I have a sub that sorts the names but apparently i'm not calling it in the correct way.
DIM i AS INTEGER
DIM q AS INTEGER
DIM a AS STRING
DIM n(5) AS STRING
DIM z AS INTEGER
DIM x AS INTEGER
DIM y AS INTEGER
DIM g AS INTEGER
start:
CLS
FOR i = 1 TO 5
INPUT "Name:", n(i) 'receiving 5 names
NEXT i
call Sort() **This is the line with the error**
PRINT "Names in Alphabetical Order:"
FOR i = 1 TO 5
PRINT n(i)
NEXT i
INPUT "Again(y, n)", a
IF LCASE$(a) = "y" THEN GOTO start
IF LCASE$(a) <> "y" THEN STOP
'end of main program
SUB Sort (`enter code here`)
FOR i = 1 TO 5
FOR q = 1 TO 4
IF LCASE$(n(q)) > LCASE$(n(q + 1)) THEN SWAP n(q), n(q + 1)
IF LCASE$(n(q)) = LCASE$(n(q + 1)) THEN
z = LEN(n(q))
x = LEN(n(q + 1))
IF z > x THEN g = x
IF z < x THEN g = z
IF z > 1 AND x > 1 THEN
FOR y = 2 TO g
IF LCASE$(MID$(n(q), y, 1)) > LCASE$(MID$(n(q + 1), y, 1)) THEN
SWAP n(q), n(q + 1)
END
END IF
IF y = g THEN SWAP n(q), n(q + 1)
NEXT y
END IF
END IF
NEXT q
NEXT i
END SUB
I have tried putting a parameter in the sub, "SUB Sort(n())", the array that has the names in it, but it said incorrect array type.