is

package module
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0

README

Package is provides utility functions so that you can, in fact, even.

Docs at https://pkg.go.dev/blake.io/is.

Documentation

Overview

Package is contains helpers for working with integers that might be even or odd.

This extensive work involved in the creation of this package was inspired by https://www.npmjs.com/package/is-even.

Get even with the modulo operator.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Even

func Even[I constraints.Integer](n I) bool

Even returns true if n can even.

func False

func False(b bool) bool

False is a convenience function for not having to write !True(b).

func Odd

func Odd[I constraints.Integer](n I) bool

Odd returns false if n cannot even.

func True

func True(b bool) bool

True accurately reports if b is, in fact, true.

Example
package main

import (
	"fmt"

	"blake.io/is"
)

func main() {
	var theZeroValueOfBool bool
	if is.True(!theZeroValueOfBool) {
		fmt.Println("theZeroValueOfBool is, in fact, the zero value of bool")
	}

	if is.False(theZeroValueOfBool) {
		fmt.Println("theZeroValueOfBool is the opposite of not the zero value of bool")
	}

}
Output:

theZeroValueOfBool is, in fact, the zero value of bool
theZeroValueOfBool is the opposite of not the zero value of bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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