Why does this return {0} which is incorrect? I understand that I can use the pattern StringQ but I want to use not a number here.

myList = {6, "x", 7, 8, "y", 1, 2, "z", 5};
FirstPosition[myList, _?(Not@NumberQ[#] &)]
  • 1
    $\begingroup$ You can also use the Composition operator: FirstPosition[myList, _?(Not@*NumberQ), Heads -> False] $\endgroup$
    – eldo
    Commented Apr 24 at 6:17

1 Answer 1


As written in the documentation for FirstPosition, by default, Heads is set to True. This means that the function also looks at the head of the expression, which is in your case List, and since it is not a number, it satisfies your condition. Use the option Heads -> False to get the desired output {2}.


Not the answer you're looking for? Browse other questions tagged or ask your own question.