pub fn min(comptime T: type, slice: []const T) T T: typeslice: []const T3742
3743
3744
3745
3746
3747
3748
3749pub fn min(comptime T: type, slice: []const T) T {
assert(slice.len > 0);
var best = slice[0];
for (slice[1..]) |item| {
best = @min(best, item);
}
return best;
}
Returns the smallest number in a slice. O(n).
slicemust not be empty.