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.1.0.2 tracks/go/exercises/bob/example.go
trackler-2.1.0.1 tracks/go/exercises/bob/example.go
trackler-2.1.0.0 tracks/go/exercises/bob/example.go
trackler-2.0.8.55 tracks/go/exercises/bob/example.go
trackler-2.0.8.54 tracks/go/exercises/bob/example.go
trackler-2.0.8.53 tracks/go/exercises/bob/example.go
trackler-2.0.8.52 tracks/go/exercises/bob/example.go
trackler-2.0.8.51 tracks/go/exercises/bob/example.go
trackler-2.0.8.50 tracks/go/exercises/bob/example.go
trackler-2.0.8.49 tracks/go/exercises/bob/example.go
trackler-2.0.8.48 tracks/go/exercises/bob/example.go
trackler-2.0.8.47 tracks/go/exercises/bob/example.go
trackler-2.0.8.46 tracks/go/exercises/bob/example.go
trackler-2.0.8.45 tracks/go/exercises/bob/example.go
trackler-2.0.8.44 tracks/go/exercises/bob/example.go
trackler-2.0.8.43 tracks/go/exercises/bob/example.go
trackler-2.0.8.42 tracks/go/exercises/bob/example.go
trackler-2.0.8.41 tracks/go/exercises/bob/example.go
trackler-2.0.8.40 tracks/go/exercises/bob/example.go
trackler-2.0.8.39 tracks/go/exercises/bob/example.go