Choose where you’d like to start

median()

Overview

The median() function takes numberList as an argument, sorts it in ascending order, and returns the median (lying in the middle) value in the list. If the number of elements is even, the average of the middle two elements will be returned.

Return Type

  • Decimal

Syntax

<variable> = <numberList>.median();

(OR)

<variable> = median(<numberList> );
ParameterDescriptionData type
<variable>Variable which will contain the returned value.DECIMAL
<numbeList>

The list from which the median value will be returned.

Numerical values can be specified in double quotes.

NUMBER LIST or DECIMAL LIST

Examples

numberList = {1, 5, 2, 3};
medianValue= numberList.median();     // returns 2.5

Get Started Now

Execute