Skip to content
Snippets Groups Projects
Commit b3c7a9eb authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

add ternary util

parent a13e9c8f
No related branches found
No related tags found
No related merge requests found
package ternary
// IfNotEmptyOr returns a if not empty, otherwise b
func IfNotEmptyOr(a, b string) string {
if a != "" {
return a
}
return b
}
// If returns a if con is true, b otherwise
func If(con bool, a, b interface{}) interface{} {
if con {
return a
}
return b
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment