cond

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ternary

func Ternary[T any](condition bool, ifTrue, ifFalse T) T

Ternary operator with a condition and two possible results. The condition is evaluated and the first result is returned if it is true, otherwise the second result is returned.

cond.Ternary(true, "yes", "no") // "yes"
cond.Ternary(false, "yes", "no") // "no"

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL