ArrayMin

Category: Instructions

Definition and Purpose:

The ArrayMin function in ProBuilder language is used to find the minimum value within an array. This function is particularly useful when you need to determine the smallest element from a set of values stored in an array, which can be applicable in various data analysis contexts.

Syntax:

ArrayMin($MyArray)

Here, $MyArray represents the array variable from which the minimum value will be extracted.

Example:

Suppose you have an array of closing prices for a stock over the last 5 days and you want to find the lowest closing price in that period. You could use the ArrayMin function as follows:


$myPrices[1] = 130
$myPrices[2] = 135
$myPrices[3] = 128
$myPrices[4] = 140
$myPrices[5] = 132
lowestPrice = ArrayMin($myPrices)

In this example, lowestPrice will hold the value 128, which is the minimum value in the myPrices array.

Additional Information:

  • The ArrayMin function can only be used with arrays that contain numerical data. Attempting to use it with arrays containing non-numerical data types will result in an error.
  • If the array is empty, the function will return an undefined value.

Related Instructions:

  • ArrayMax instructions
  • ArraySort instructions
  • IsSet instructions
  • LastSet instructions
  • Unset instructions
  • Logo Logo
    Loading...