if_expression

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Return

func Return[T any](boolExpression bool, trueReturnValue, falseReturnValue T) T

Return

@Description: if实现的三元表达式
@param boolExpression: 布尔表达式,最终返回一个布尔值
@param trueReturnValue: 当boolExpression返回值为true的时候返回的值
@param falseReturnValue: 当boolExpression返回值为false的时候返回的值
@return bool: 三元表达式的结果,为trueReturnValue或者falseReturnValue中的一个

func ReturnByFunc

func ReturnByFunc[T any](boolExpression bool, trueFuncForReturnValue, falseFuncForReturnValue func() T) T

ReturnByFunc

@Description: if实现的三元表达式
@param boolExpression: 布尔表达式,最终返回一个布尔值
@param trueReturnValue: 当boolExpression返回值为true的时候执行此函数并返回值
@param falseReturnValue: 当boolExpression返回值为false的时候执行此函数并返回值
@return bool: 三元表达式的结果,为trueReturnValue或者falseReturnValue中的一个

Types

This section is empty.

Jump to

Keyboard shortcuts

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