Created
June 11, 2021 02:11
-
-
Save atultw/b955f70536a6de0540512fb2f7aac5a6 to your computer and use it in GitHub Desktop.
go ternary
This file contains 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
func cond(expr bool, yes interface{}, no interface{}) interface{} { | |
if expr { | |
return yes | |
} else { | |
return no | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment