DIM haystack$(27) haystack$() = "alpha","bravo","charlie","delta","echo","foxtrot","golf", \ \ "hotel","india","juliet","kilo","lima","mike","needle", \ \ "november","oscar","papa","quebec","romeo","sierra","tango", \ \ "needle","uniform","victor","whisky","x-ray","yankee","zulu" needle$ = "needle" maxindex% = DIM(haystack$(), 1) FOR index% = 0 TO maxindex% IF needle$ = haystack$(index%) EXIT FOR NEXT IF index% <= maxindex% THEN PRINT "First found at index "; index% FOR last% = maxindex% TO 0 STEP -1 IF needle$ = haystack$(last%) EXIT FOR NEXT IF last%<>index% PRINT "Last found at index "; last% ELSE ERROR 100, "Not found" ENDIF