proverbs

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

README

proverbs

Purpose

proverbs helps me explaining both modules and vanity import paths in my course Master Go.

You can use it for integrating Go proverbs into your code.

Usage

package main

import (
	"fmt"

	"appliedgo.net/proverbs"
)

func main() {
	fmt.Println("Random proverb:", proverbs.Random())
	for i := 0; i < 19; i++ {
		fmt.Printf("Proverb no %d: %s\n", i+1, proverbs.No(i))
	}
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func No

func No(n int) string

No prints out proverb no. n.

Example
package main

import (
	"fmt"

	"appliedgo.net/proverbs"
)

func main() {
	fmt.Println(proverbs.No(18))

}
Output:

Don't panic.

func Random

func Random() string

Random returns a random Go Proverb. Ensure to initialize math/rand with a random seed value, in order to get true random output.

Example
package main

import (
	"fmt"

	"appliedgo.net/proverbs"
)

func main() {
	fmt.Println(proverbs.Random())
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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