Matt Wozniski wrote:
> Using ==, strings and numbers can compare as equal, and using index()
> on a list, this is not the case:
>
> :echo "2" == 2 " Returns 1
> :echo index( [ 2 ], "2") " Returns -1
>
> The docs just say that index() will "Return the lowest index in |List|
> {list} where the item has a value equal to {expr}", leading one to
> assume that equality is checked in the same way as ==, but looking at
> the source, we're using a function that "Compares the items just like
> "==" would compare them, but strings and numbers are different". So,
> is this a behavioral bug, or should the help just make a note that
> strings and numbers will not be considered equal?
This intentional, there is no automatic conversion here. I'll add a
remark about this, as I can understand that this may be confusing.
--
I wonder how much deeper the ocean would be without sponges.
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---