Choose where you’d like to start

nthSmallest

Overview

The nthSmallest function operates on a collection of numerical values. It sorts the values in ascending 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>.nthSmallest(<number>);

where,

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

Examples

 marks = {300,455,124,926,780};
 result = marks.nthSmallest(2);
 info result; // Returns 300

Related Examples

Get Started Now

Execute