16 lines
280 B
Go
16 lines
280 B
Go
/*
|
|
* @FileName: if.go
|
|
* @Author: JJXu
|
|
* @CreateTime: 2022/3/31 下午10:34
|
|
* @Description:
|
|
*/
|
|
|
|
package util
|
|
|
|
func If[T int | int64 | int32 | string | float32 | float64 | bool](condition bool, trueVal, falseVal T) T {
|
|
if condition {
|
|
return trueVal
|
|
}
|
|
return falseVal
|
|
}
|