Calculates the average value of the data contained in an array. Its behavior is defined for numeric element types only. The return type will be the same as the type of the array.
| Arguments |
|
| Returns | The average value of all numeric elements of the array. If the array is empty, returns 0 (zero). If the array contains null elements, they are ignored in the calculation. With an array containing only null elements, the function will also return 0 (zero). |
array as Decimal [] = [10.49, 13.78, null, 33.99] display avg(array)
Counts the number of non-null elements contained in an array.
| Arguments |
|
| Returns | An Integer value with the index. If the element is not found, returns -1. If the array is empty, returns -1. |
array as Int[]=[22,33,null,55] display count(array)
This function returns the index of the first occurrence of an element in the array. The array index starts at zero for the first element.
| Arguments |
|
| Returns | An Integer value with the index. If the element is not found, returns -1. If the array is empty, returns -1. |
array as String[] = ["Hello","!!!","world","!!!"] display indexOf(array, "!!!")
This function searches the array for matching elements, and returns the index of the element's last occurrence. The array index starts at zero for the first element.
| Arguments |
|
| Returns | An Integer value with the index. If the element is not found, returns -1. If the array is empty, returns -1. |
array as String[] = ["Hello","world","!!!"] display indexOf(array, "happy")
array as String[] = ["Hello","world","!!!"] display indexOf(array, "!!!")
array as String[] = ["Hello","!!!","world","!!!"] display lastIndexOf(array, "!!!")
This function returns the length of the array.
| Arguments |
|
| Returns | An Integer value with the number of elements in the array. If the array is empty, returns 0 (zero). |
array as Int[] = [7,8,9,10] display length(array)
This function returns the maximum element of the array. The element type must have a defined sorting order. The return type will be the same as the type of the array.
| Arguments |
|
| Returns | The maximum element of the array. If the array is empty, returns a null value. |
array as String[]=["A","B","C","D"] display max(array)
This function returns the minimum element of the array. The element type must have a default ordering defined. The return type will be the same as the type of the array.
| Arguments |
|
| Returns | The minimum element of the array. If the array is empty, returns a null value. |
array as Int[]=[22,33,44,55] display min(array)
Calculates the sum of all the elements of the array. This function is defined for numeric element types only.
| Arguments |
|
| Returns | The sum of all the elements of the array. If the array has no elements, returns 0 (zero). |
array as Int[]=[112,3233,454,595] display sum(array)