goext/langext/bool.go

18 lines
259 B
Go
Raw Permalink Normal View History

2022-10-27 16:48:26 +02:00
package langext
func FormatBool(v bool, strTrue string, strFalse string) string {
if v {
return strTrue
} else {
return strFalse
}
}
2022-11-19 16:58:18 +01:00
func Conditional[T any](v bool, resTrue T, resFalse T) T {
if v {
return resTrue
} else {
return resFalse
}
}