operatorpkg

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

operator

三元表达式辅助函数。

基础用法

name := operatorpkg.Ternary(ok, "yes", "no")

注意事项

只适合简单值选择;复杂分支使用普通 if 更清晰。

验证

go test ./operator

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ternary

func Ternary[T any](cond bool, v1 T, v2 T) T

Ternary 三元表达式 = cond ? v1 : v2

Types

This section is empty.

Jump to

Keyboard shortcuts

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