op

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 0 Imported by: 1

README

Operator

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ternary

func Ternary(statement bool, a, b interface{}) interface{}
Example

範例說明: Ternary

i := 30
fmt.Println(Ternary(i%2 == 0, "even", "odd").(string))
fmt.Println(Ternary(i > 30, 300, -1).(int))
Output:

even
-1

Types

This section is empty.

Jump to

Keyboard shortcuts

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