From 9d9a6f1c6eda6c22a861e10fb1ec09dcee8c462a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 19 Nov 2022 16:58:18 +0100 Subject: [PATCH] v0.0.21 --- langext/bool.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/langext/bool.go b/langext/bool.go index cc5dc74..cd00461 100644 --- a/langext/bool.go +++ b/langext/bool.go @@ -7,3 +7,11 @@ func FormatBool(v bool, strTrue string, strFalse string) string { return strFalse } } + +func Conditional[T any](v bool, resTrue T, resFalse T) T { + if v { + return resTrue + } else { + return resFalse + } +}