The [max] method compares two values and returns the larger of the two.
While this method is most commonly used with numeric parameters it may be used to compare objects of other types such as strings or even compound types like pairs and arrays. In these cases the first character of the string, or the first character of the first element of a compound data type is used for comparison.
max( value_1, value_2 )
Use the [max] method. This example iterates through an array of values and uses the [max] method to return the maximum value of the data set.
Code
var( temperatures = array(27, 25, 30, 22, 31, 28, 27),
maxTemp = integer )
with t in $temperatures
do => {
$maxTemp = max($maxTemp, #t)
}
'The maximum temperature was '+$maxTemp+' degrees.'
Result
The maximum temperature was 31 degrees.
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments