| 1 |
package util |
| 2 |
|
| 3 |
// Min returns the smaller of two integers. |
| 4 |
// |
| 5 |
// Parameters: |
| 6 |
// - a: The first integer to compare. |
| 7 |
// - b: The second integer to compare. |
| 8 |
// |
| 9 |
// Returns: |
| 10 |
// - The smaller of a and b. If they are equal, returns a. |
| 11 |
func Min(a, b int) int { |
| 12 |
if a < b { |
| 13 |
return a |
| 14 |
} |
| 15 |
|
| 16 |
return b |
| 17 |
} |
| 18 |
|
| 19 |
// Max returns the larger of two integers. |
| 20 |
// |
| 21 |
// Parameters: |
| 22 |
// - a: The first integer to compare. |
| 23 |
// - b: The second integer to compare. |
| 24 |
// |
| 25 |
// Returns: |
| 26 |
// - The larger of a and b. If they are equal, returns a. |
| 27 |
func Max(a, b int) int { |
| 28 |
if a > b { |
| 29 |
return a |
| 30 |
} |
| 31 |
|
| 32 |
return b |
| 33 |
} |