Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 353 Bytes

README.md

File metadata and controls

25 lines (18 loc) · 353 Bytes

ternary

API

  • TernaryExpr
TernaryExpr[T any](boolExpr bool, trueReturn T, falseReturn T) T

EXAMPLE

package main

import (
	"fmt"
	"github.com/songzhibin97/go-baseutils/base/bternaryexpr"
)

func main() {
	fmt.Println(bternaryexpr.TernaryExpr(true, 1, 2))  // 1
	fmt.Println(bternaryexpr.TernaryExpr(false, 1, 2)) // 2
}