Skip to content

Instantly share code, notes, and snippets.

@atultw
Created June 11, 2021 02:11
Show Gist options
  • Save atultw/b955f70536a6de0540512fb2f7aac5a6 to your computer and use it in GitHub Desktop.
Save atultw/b955f70536a6de0540512fb2f7aac5a6 to your computer and use it in GitHub Desktop.
go ternary
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