This commit is contained in:
Kovid Goyal
2023-07-02 12:15:44 +05:30
parent d4127229b6
commit 10362c3121
2 changed files with 10 additions and 5 deletions

View File

@@ -248,3 +248,10 @@ func SetStructDefaults(v reflect.Value) (err error) {
}
return
}
func IfElse[T any](condition bool, if_val T, else_val T) T {
if condition {
return if_val
}
return else_val
}