goternary

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 1 Imported by: 0

README

go-ternary

An alternative function for ternary operation

Usage

    function main() {
        a := 5
        b := 7

        result := goternary.Ternary(a < b, "a is less than b", "a is greater than b").(string)
        fmt.Printf("result: %v\n", result)
    }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ternary

func Ternary(condition bool, leftValue, rightValue any) any

An alternative function for ternary operation

func TernaryValue added in v1.0.1

func TernaryValue(condition bool, leftValue, rightValue any) any

An alternative function for ternary operation, returns value if pointer is received

Types

This section is empty.

Jump to

Keyboard shortcuts

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