stdORD_MAX function

dynamic stdORD_MAX(
  1. List values
)

ORD-MAX: returns the 1-based index of the maximum value

Implementation

dynamic stdORD_MAX(List<dynamic> values) {
  if (values.isEmpty) return 0;
  int bestIdx = 0;
  for (var i = 1; i < values.length; i++) {
    if (varToDouble(values[i]) > varToDouble(values[bestIdx])) bestIdx = i;
  }
  return bestIdx + 1;
}