index() function delivers all results when given a {} empty list as index parameter

Hey folks!

 

I could use some help with clarifying something.

The index() function has a "default" parameter. The intention of it becomes clear when we read it's description in the documentation:

default: (Any Type) The default value to be returned if the array or the index is invalid, such as if the array itself is empty or the index is < 1 or > array length.

So the way I see it: I want the default value to kick into action if the index parameter of the index function receives anything that is invalid. Say "null" for example. This works perfectly fine EXCEPT when the index parameter receives an empty list.

For example: 

index({10, 20, 30}, {}, 1)

returns 10; 20; 30. So basically I get the whole shabang back.

That feels somewhat inconsistent to me. Is this intended behaviour?

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data