DEF SEARCH(ARRAY,LOOK) FOR I = 0 TO LEN(ARRAY)-1 IF ARRAY[I]==LOOK THEN RETURN I NEXT ENDbut this is very inefficient speed-wise. but an alternative, which is 25% faster is bilinear search:
DEF BILINEARSEARCH(ARRAY,LOOK) VAR L = LEN(ARRAY)-1,L2=L/2 FOR I = 0 TO L2 IF ARRAY[L2+I]==LOOK THEN RETURN L2+I IF ARRAY[L2-I]==LOOK THEN RETURN L2-I NEXT IF ARRAY[L]==LOOK THEN RETURN L RETURN -1 END