exts

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package exts は、標準で用意されている型に対して拡張機能を追加したエイリアス型を定義しているパッケージです。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Num

type Num int

Num は、int のエイリアス型です。 int を扱う上で少し便利なメソッドを提供します。

func (Num) Downto

func (me Num) Downto(to int, fn func(i int))

Downto は、自身の値から to 値までの回数ループし、ループの度に fn を実行します。 fn の引数に指定されるのは index となります。 Upto との違いは、Uptoはインデックスが正の方向に上がっていく(i++)のに対し、Downto は負の方向へ下がっていきます。(i--)

func (Num) Times

func (me Num) Times(fn func(i int))

Times は、自身の値と同じ回数ループし、ループの度に fn を実行します。 fn の引数に指定されるのは index となります。

func (Num) ToStr

func (me Num) ToStr() string

ToStr は、自身の値を文字列で返します。

func (Num) Upto

func (me Num) Upto(to int, fn func(i int))

Upto は、自身の値から to の値までの回数ループし、ループの度に fn を実行します。 fn の引数に指定されるのは index となります。 Downto との違いは、Uptoはインデックスが正の方向に上がっていく(i++)のに対し、Downto は負の方向へ下がっていきます。(i--)

Jump to

Keyboard shortcuts

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