Help us shape the future of Go! Take the 2026 Go Developer Survey

bools

package
v1.104.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-3-Clause Imports: 0 Imported by: 1

Documentation

Overview

Package bools contains the Int, Compare, and IfElse functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T ~bool](x, y T) int

Compare compares two boolean values as if false is ordered before true.

func IfElse added in v1.80.0

func IfElse[T any](condExpr bool, trueVal T, falseVal T) T

IfElse is a ternary operator that returns trueVal if condExpr is true otherwise it returns falseVal. IfElse(c, a, b) is roughly equivalent to (c ? a : b) in languages like C.

func Int added in v1.82.0

func Int(v bool) int

Int returns 1 for true and 0 for false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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