Skip to content

Commit

Permalink
Updated with edits
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-dew committed Jan 8, 2019
1 parent 083519b commit f8fdee8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/n1ql/pages/n1ql-language-reference/arrayfun.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ SELECT ARRAY_AVG([0,1,1,2,3,5]) AS array_average;
=== Description
This function returns the first position of the specified value [.var]`val` within the sorted array [.var]`expr`.

The array position is one-based, that is, the first position is 1.
The array position is zero-based, that is, the first position is 0.

NOTE: This function uses a binary search algorithm.
If the array is unsorted, the function may not be able to find the value.
Expand All @@ -160,7 +160,8 @@ expr:: [Required] The array you want to search, sorted in N1QL collation order.
val:: [Required] The value whose position you want to find.

=== Return Values
An integer representing the first position of the input [.var]`val`, where the first position is 1.
An integer representing the first position of the input [.var]`val`, where the first position is 0.
If the value [.var]`val` occurs more than once within the array [.var]`expr`, only the first position is returned.

It returns -1 if the input [.var]`val` is not found in the array.

Expand Down Expand Up @@ -766,6 +767,7 @@ val:: [Required] The value whose position you want to know.

=== Return Values
An integer representing the first position of the input [.var]`val`, where the first position is 0.
If the value [.var]`val` occurs more than once within the array [.var]`expr`, only the first position is returned.

It returns -1 if the input [.var]`val` does not exist in the array.

Expand Down

0 comments on commit f8fdee8

Please sign in to comment.