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

Version Path
trackler-2.2.1.159 tracks/go/exercises/proverb/example.go
trackler-2.2.1.158 tracks/go/exercises/proverb/example.go
trackler-2.2.1.157 tracks/go/exercises/proverb/example.go
trackler-2.2.1.156 tracks/go/exercises/proverb/example.go
trackler-2.2.1.155 tracks/go/exercises/proverb/example.go
trackler-2.2.1.154 tracks/go/exercises/proverb/example.go
trackler-2.2.1.153 tracks/go/exercises/proverb/example.go
trackler-2.2.1.152 tracks/go/exercises/proverb/example.go
trackler-2.2.1.151 tracks/go/exercises/proverb/example.go
trackler-2.2.1.150 tracks/go/exercises/proverb/example.go
trackler-2.2.1.149 tracks/go/exercises/proverb/example.go
trackler-2.2.1.148 tracks/go/exercises/proverb/example.go
trackler-2.2.1.147 tracks/go/exercises/proverb/example.go
trackler-2.2.1.146 tracks/go/exercises/proverb/example.go
trackler-2.2.1.145 tracks/go/exercises/proverb/example.go
trackler-2.2.1.144 tracks/go/exercises/proverb/example.go
trackler-2.2.1.143 tracks/go/exercises/proverb/example.go
trackler-2.2.1.142 tracks/go/exercises/proverb/example.go
trackler-2.2.1.141 tracks/go/exercises/proverb/example.go
trackler-2.2.1.140 tracks/go/exercises/proverb/example.go