Skip to content

v1.0.0 (Initial release)

Latest
Compare
Choose a tag to compare
@thedevsaddam thedevsaddam released this 24 Apr 23:55
· 1 commit to master since this release
package main

import (
	"fmt"

	"github.com/thedevsaddam/iter"
)

func main() {
	// sequence: 0-9
	for v := range iter.N(10) {
		fmt.Printf("%d ", v)
	}
	fmt.Println()
	// output: 0 1 2 3 4 5 6 7 8 9

	// sequence: 5-9
	for v := range iter.N(5, 10) {
		fmt.Printf("%d ", v)
	}
	fmt.Println()
	// output: 5 6 7 8 9

	// sequence: 1-9, increment by 2
	for v := range iter.N(5, 10, 2) {
		fmt.Printf("%d ", v)
	}
	fmt.Println()
	// output: 5 7 9

	// sequence: a-e
	for v := range iter.L('a', 'e') {
		fmt.Printf("%s ", string(v))
	}
	fmt.Println()
	// output: a b c d e
}