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.180 tracks/go/exercises/proverb/example.go
trackler-2.2.1.179 tracks/go/exercises/proverb/example.go
trackler-2.2.1.178 tracks/go/exercises/proverb/example.go
trackler-2.2.1.177 tracks/go/exercises/proverb/example.go
trackler-2.2.1.176 tracks/go/exercises/proverb/example.go
trackler-2.2.1.175 tracks/go/exercises/proverb/example.go
trackler-2.2.1.174 tracks/go/exercises/proverb/example.go
trackler-2.2.1.173 tracks/go/exercises/proverb/example.go
trackler-2.2.1.172 tracks/go/exercises/proverb/example.go
trackler-2.2.1.171 tracks/go/exercises/proverb/example.go
trackler-2.2.1.170 tracks/go/exercises/proverb/example.go
trackler-2.2.1.169 tracks/go/exercises/proverb/example.go
trackler-2.2.1.167 tracks/go/exercises/proverb/example.go
trackler-2.2.1.166 tracks/go/exercises/proverb/example.go
trackler-2.2.1.165 tracks/go/exercises/proverb/example.go
trackler-2.2.1.164 tracks/go/exercises/proverb/example.go
trackler-2.2.1.163 tracks/go/exercises/proverb/example.go
trackler-2.2.1.162 tracks/go/exercises/proverb/example.go
trackler-2.2.1.161 tracks/go/exercises/proverb/example.go
trackler-2.2.1.160 tracks/go/exercises/proverb/example.go