ints

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: GPL-3.0 Imports: 0 Imported by: 2

Documentation

Index

Examples

Constants

View Source
const (
	MaxUint = ^uint(0)
	MinUint = 0
	MinInt  = -MaxInt - 1
	MaxInt  = int(MaxUint >> 1)
)

Variables

This section is empty.

Functions

func Max

func Max(numbers ...int) (max int)

Returns the maximum of all the given integers.

func Min

func Min(numbers ...int) (min int)

Returns the minimum of all the given integers.

func Range

func Range(start, end, step int) []int

Generates an integer array with indices from start to end with the given step value.

Returns an empty array if step is equal to 0 or end is less than start and step is a positive number.

Example

Counting down from 10 in intervals of 2.

The Range function is similar to the range function in Python.

r := Range(10, 0, -2)
fmt.Println(r)
Output:
[10 8 6 4 2 0]

Types

This section is empty.

Jump to

Keyboard shortcuts

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