#COMPILE EXE "s25_array_search.exe"
' Sample: Searching an array (linear search)
FUNCTION PBMAIN() AS LONG
    DIM arr(5) AS LONG, i AS LONG, target AS LONG, found AS LONG
    arr(0)=10: arr(1)=25: arr(2)=30: arr(3)=45: arr(4)=60: arr(5)=80
    target = 45: found = -1
    FOR i = 0 TO 5
        IF arr(i) = target THEN found = i: EXIT FOR
    NEXT i
    PRINT "Target"; target;
    IF found >= 0 THEN PRINT " found at index"; found ELSE PRINT " not found"
    FUNCTION = 0
END FUNCTION
