I just stumbled upon this strange problem:
echo 'test' ==# 0
This returns 1
. Therefore it is true. But in "reality" it is not true. Any string is different from 0.
How to do this check?
For a bit more context, I actually stumbled upon it with the following code:
let l= ['one', 'two', 'three']
let value = get(l, 5)
if value ==# 0
" do something if the list does not contain index 5
else
" do something with the value of the 5th list item
end
get()
returns 0 if the given index is not found in the list. I need to be able to check for this case. But how to do this?