You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
/*
|
|
* @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
|
|
}
|