Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Max ¶
Max returns the largest value among a fixed number of arguments of type [Ordered]. At least one argument must be passed, and it returns that if it's the only one. It compares all the provided values and returns the maximum value.
max := Max(3, 5, 2) // max is 5
Example ¶
package main import ( "fmt" "github.com/exonlabs/go-utils/pkg/abc/gx" ) func main() { // Finding the max value maxInt := gx.Max(3, 1, 4, 2) // maxInt will be 4 maxFloat := gx.Max(5.1, 2.3, 8.7) // maxFloat will be 8.7 maxStr := gx.Max("apple", "banana") // maxStr will be "banana" fmt.Println(maxInt, maxFloat, maxStr) }
Output: 4 8.7 banana
func Min ¶
Min returns the smallest value among a fixed number of arguments of type [Ordered]. At least one argument must be passed, and it returns that if it's the only one. It compares all the provided values and returns the minimum value.
min := Min(3, 5, 2) // min is 2
Example ¶
package main import ( "fmt" "github.com/exonlabs/go-utils/pkg/abc/gx" ) func main() { // Finding the min value minInt := gx.Min(3, 1, 4, 2) // minInt will be 1 minFloat := gx.Min(5.1, 2.3, 8.7) // minFloat will be 2.3 minStr := gx.Min("apple", "banana") // minStr will be "apple" fmt.Println(minInt, minFloat, minStr) }
Output: 1 2.3 apple
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.