Skip to content

Commit

Permalink
docs(tricks): coalesce standard alternative
Browse files Browse the repository at this point in the history
Signed-off-by: Pouyan Heyratpour <me@pouyan.dev>
  • Loading branch information
pouyanh committed Sep 24, 2024
1 parent cc1b681 commit bc3c72d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tricks/syntheis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tricks

// Coalesce returns left-most non-zero value
// It's like cmp.Or
func Coalesce[T comparable](tt ...T) T {
var zero T
if len(tt) == 0 {
Expand Down

0 comments on commit bc3c72d

Please sign in to comment.