Sha256: ae24abf60eac589629c4bf923d2146b95e42c212ec0cfe040dc7d8583903a3b7

Contents?: true

Size: 579 Bytes

Versions: 158

Compression:

Stored size: 579 Bytes

Contents

package bob

import "strings"

const testVersion = 2

func Hey(drivel string) string {
	switch drivel = strings.TrimSpace(drivel); {
	case silent(drivel):
		return "Fine. Be that way!"
	case yelling(drivel):
		return "Whoa, chill out!"
	case asking(drivel):
		return "Sure."
	default:
		return "Whatever."
	}
}

func yelling(drivel string) bool {
	return strings.ToUpper(drivel) == drivel && strings.ToLower(drivel) != strings.ToUpper(drivel)
}

func asking(drivel string) bool {
	return strings.HasSuffix(drivel, "?")
}

func silent(drivel string) bool {
	return drivel == ""
}

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
trackler-2.0.8.17 tracks/go/exercises/bob/example.go
trackler-2.0.8.16 tracks/go/exercises/bob/example.go
trackler-2.0.8.15 tracks/go/exercises/bob/example.go
trackler-2.0.8.14 tracks/go/exercises/bob/example.go
trackler-2.0.8.13 tracks/go/exercises/bob/example.go
trackler-2.0.8.12 tracks/go/exercises/bob/example.go
trackler-2.0.8.11 tracks/go/exercises/bob/example.go
trackler-2.0.8.10 tracks/go/exercises/bob/example.go
trackler-2.0.8.9 tracks/go/exercises/bob/example.go
trackler-2.0.8.8 tracks/go/exercises/bob/example.go
trackler-2.0.8.7 tracks/go/exercises/bob/example.go
trackler-2.0.8.6 tracks/go/exercises/bob/example.go
trackler-2.0.8.5 tracks/go/exercises/bob/example.go
trackler-2.0.8.4 tracks/go/exercises/bob/example.go
trackler-2.0.8.3 tracks/go/exercises/bob/example.go
trackler-2.0.8.2 tracks/go/exercises/bob/example.go
trackler-2.0.8.1 tracks/go/exercises/bob/example.go
trackler-2.0.7.0 tracks/go/exercises/bob/example.go
trackler-2.0.6.44 tracks/go/exercises/bob/example.go
trackler-2.0.6.43 tracks/go/exercises/bob/example.go