github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bternaryexpr/uternaryexpr.go (about) 1 package bternaryexpr 2 3 func TernaryExpr[T any](boolExpr bool, trueReturn T, falseReturn T) T { 4 if boolExpr { 5 return trueReturn 6 } 7 return falseReturn 8 }