slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] possible returns values for where


Joe Miller <lpe540@xxxxxxxxx> wrote:
>the script does essencially the following
>    index = where (x < y);
>    if ((length (index) == 1) and (index[0] != -1)){
>        ....
>    }
>As far as I know there's no way for the 'where'
>function to return a negative value. But I wanted to
>double check before I took it out.

  The elements of the array returned by `where` will be >= 0.  Note
that the above is also flawed because `where` can return an array with
no elements, and since the `and` operator does not short-circuit, the
execution of index[0] will result in a range-error if index has no
elements.

--John

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]