Last active
August 27, 2023 12:16
-
-
Save pedrobertao/ecb14746900c8730e6c066ca2cf2ebeb to your computer and use it in GitHub Desktop.
Min/Max Golang 1.21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
minInt := min(3, 2, 1, 4) | |
minFloat := min(4.0, 2.0, 3.0, 1.0) | |
minString := min("ab", "a", "abcd", "abc") | |
fmt.Println("Min Integer:", minInt) | |
fmt.Println("Min Float:", minFloat) | |
fmt.Println("Min String:", minString) | |
fmt.Println("==================") | |
maxInt := max(4, 2, 3, 1) | |
maxFloat := max(1.0, 4.0, 2.0, 3.0) | |
maxString := max("a", "ab", "abc", "abcd") | |
fmt.Println("Max Integer:", maxInt) | |
fmt.Println("Max Float:", maxFloat) | |
fmt.Println("Max String:", maxString) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment