Skip to content

Commit 2f5e2f6

Browse files
cuonglmgopherbot
authored andcommitted
builtin: add documentation for min/max
Updates #59488 Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d Reviewed-on: https://go-review.googlesource.com/c/go/+/498495 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]>
1 parent ce8146e commit 2f5e2f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/builtin/builtin.go

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ for the language's special identifiers.
1010
*/
1111
package builtin
1212

13+
import "cmp"
14+
1315
// bool is the set of boolean values, true and false.
1416
type bool bool
1517

@@ -206,6 +208,14 @@ func cap(v Type) int
206208
// unbuffered.
207209
func make(t Type, size ...IntegerType) Type
208210

211+
// The max built-in function returns the largest value of a fixed number of
212+
// arguments of [cmp.Ordered] types. There must be at least one argument.
213+
func max[T cmp.Ordered](x T, y ...T) T
214+
215+
// The min built-in function returns the smallest value of a fixed number of
216+
// arguments of [cmp.Ordered] types. There must be at least one argument.
217+
func min[T cmp.Ordered](x T, y ...T) T
218+
209219
// The new built-in function allocates memory. The first argument is a type,
210220
// not a value, and the value returned is a pointer to a newly
211221
// allocated zero value of that type.

0 commit comments

Comments
 (0)