Sha256: dcfe057ad101c5bfef10c86b2a8a7f6917b416374a949587709925fb178602f8
Contents?: true
Size: 484 Bytes
Versions: 72
Compression:
Stored size: 484 Bytes
Contents
// Package proverb deals with outputting the lines of a rhyme. package proverb import "fmt" // Proverb outputs the lines of for want of a nail func Proverb(rhyme []string) []string { if len(rhyme) == 0 { return []string{} } var r []string if len(rhyme) > 1 { for i := 0; i < len(rhyme)-1; i++ { r = append(r, fmt.Sprintf("For want of a %s the %s was lost.", rhyme[i], rhyme[i+1])) } } r = append(r, fmt.Sprintf("And all for the want of a %s.", rhyme[0])) return r }
Version data entries
72 entries across 72 versions & 1 rubygems