Arnaud,
Thanks for adding to my understanding of these functions. I rarely use the
0 element of an array, although I do use it in drowdown menus to display a
menu name. But it is good to know that these functions ignore the 0 element
by default.
I have assumed that Find in array uses the 3rd parameter to speed up the
search, especially with large arrays.
Cheers,
Alan

On Sun, Aug 21, 2016 at 9:23 AM, Arnaud de Montard <[email protected]> wrote:

>
> > Le 20 août 2016 à 21:57, Alan Tilson <[email protected]> a écrit :
> >
> > Hello again Alan,
> > Removing the third parameter seems to fix things!
> > Thanks for catching that one. I must have carried it over from Find in
> > Array, which does have an optional 3rd parameter.
>
> It's useful when you use the 0 index of the array:
>
> +++
> ARRAY LONGINT($_al;0)
> $_al{0}:=1
> $nbRows_l:=3
> For ($i_l;1;$nbRows_l)
>         APPEND TO ARRAY($_al;$i_l%2)
> End for
>
> ASSERT(Find in array($_al;1)=1)
> ASSERT(Find in array($_al;0)=2)
> ASSERT(Find in array($_al;1;0)=0)  //starting from 0 is allowed
>
> ASSERT(Count in array($_al;1)=2)  //0 not considered
> +++
>
> From the last line of the code above, the 0 index is not considered by the
> 'Count in array' function.
> Displaying 'Count in array($_al;1;Random)' in debugger shows the
> undocumented 3rd parameter must be avoided.
>
> --
> Arnaud de Montard
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
>
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to