Task[edit]
Find the index of a string (needle) in an indexable, ordered collection of strings (haystack).

Raise an exception if the needle is missing.

If there is more than one occurrence then return the smallest index to the needle.

Extra credit
Return the largest index to a needle that has multiple occurrences in the haystack.

See also
 Search a list of records

      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