Choose where you’d like to start

nthLargest

Overview

The nthLargest function operates on a collection of numerical values. It sorts the values in descending order and returns the value at the requested index in that order.

Note:

  • The numerical values should be available inside a collection.
  • The index argument cannot be greater than the size of the collection.
  • The index argument starts from 1.

Return Type

  • NUMBER / DECIMAL

Syntax

<variable> = <numberCollection>.nthLargest(<number>);

where,

ParameterData typeDescription
<variable>NUMBERVariable which contains the nth largest value from the collection.
<numberCollection>COLLECTIONThe collection of numerical values (includes NUMBER and DECIMAL).
<number>NUMBERThe rank of the numerical value which needs to be retrieved from the collection.

Examples

 marks = Collection(300,455,124,926,780);
 result = marks.nthlargest(5);
 info result; // Returns 124

Related Examples

Get Started Now

Execute