mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
10 lines
139 B
Go
10 lines
139 B
Go
package expr
|
|
|
|
// 如为真返回参数一,否则返回参数二
|
|
func If[T any](e bool, v1, v2 T) T {
|
|
if e {
|
|
return v1
|
|
}
|
|
return v2
|
|
}
|