tailscale.comtailscale.com/types/bools Index | Files

package bools

import "tailscale.com/types/bools"

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

Index

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

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

func Int(v bool) int

Int returns 1 for true and 0 for false.

Source Files

bools.go

Version
v1.84.0 (latest)
Published
May 21, 2025
Platform
linux/amd64
Last checked
1 day ago

Tools for package owners.