Returns the minimum value in a list of numbers.
Use Iterable.reduce()
in combination with min()
to find the minimum value.
代码实现
import 'dart:math';
num min(List<num> nums){
return nums.reduce(math.min);
}
使用样例
min([4, 6, 1, 2, 5]); // 1
Returns the minimum value in a list of numbers.
Use Iterable.reduce()
in combination with min()
to find the minimum value.
import 'dart:math';
num min(List<num> nums){
return nums.reduce(math.min);
}
min([4, 6, 1, 2, 5]); // 1