Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Choose ¶
Choose implements the missing ternary (?:) operator. When the provided expression evalutes to true, the first result parameter is returned; otherwise the second.
Choose(len(s) == 1, "true", "false")
func Coalesce ¶ added in v1.29.0
func Coalesce[T comparable](v ...T) T
Coalesce returns the first non-zero value in the provided arguments. If no argument is non-zero, the zero value is returned.
Coalesce("", "", "hello", "") // "hello" Coalesce(nil, ptr, nil) // ptr
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.