mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 16:58:09 +02:00
DRYer
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user