Documentation ¶
Index ¶
- func And[T, U any](a T, b U) bool
- func Bool[T any](value T) bool
- func Nand[T, U any](a T, b U) bool
- func Nor[T, U any](a T, b U) bool
- func Or[T, U any](a T, b U) bool
- func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
- func Xnor[T, U any](a T, b U) bool
- func Xor[T, U any](a T, b U) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool 返回传入参数的bool值.
如果出入类型参数含有Bool方法, 会调用该方法并返回 如果传入类型参数有IsZero方法, 返回IsZero方法返回值的取反 slices和map的length大于0时,返回true,否则返回false 其他类型会判断是否是零值
func TernaryOperator ¶
func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
TernaryOperator 三目运算符(三元运算符)
!!!: 传参 ifValue 和 elseValue,如果涉及复杂运算(调用方法或函数...),还是老老实实使用 if else 吧.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.