Skip to content

Commit

Permalink
add ternary tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Tchoupinax committed May 7, 2024
1 parent 40a19ed commit 9ac10e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ func askForConfirmation(s string) bool {
}
}
}

func If[T any](cond bool, vtrue, vfalse T) T {
if cond {
return vtrue
}
return vfalse
}

0 comments on commit 9ac10e9

Please sign in to comment.