index of the first matching element. -1 if not found
Arguments: dat is the element to search for i is the index from where to start, default is 0 forward if true, searches in a forward direction, from lower index to higher
See Implementation