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.5.1 tracks/go/exercises/bob/example.go
trackler-2.0.5.0 tracks/go/exercises/bob/example.go
trackler-2.0.4.0 tracks/go/exercises/bob/example.go
trackler-2.0.3.9 tracks/go/exercises/bob/example.go
trackler-2.0.3.8 tracks/go/exercises/bob/example.go
trackler-2.0.3.7 tracks/go/exercises/bob/example.go
trackler-2.0.3.6 tracks/go/exercises/bob/example.go
trackler-2.0.3.5 tracks/go/exercises/bob/example.go
trackler-2.0.3.4 tracks/go/exercises/bob/example.go
trackler-2.0.3.3 tracks/go/exercises/bob/example.go
trackler-2.0.3.2 tracks/go/exercises/bob/example.go
trackler-2.0.3.1 tracks/go/exercises/bob/example.go
trackler-2.0.3.0 tracks/go/exercises/bob/example.go
trackler-2.0.2.0 tracks/go/exercises/bob/example.go
trackler-2.0.1.2 tracks/go/exercises/bob/example.go
trackler-2.0.1.1 tracks/go/exercises/bob/example.go
trackler-2.0.1.0 tracks/go/exercises/bob/example.go
trackler-2.0.0.10 tracks/go/exercises/bob/example.go
trackler-2.0.0.9 tracks/go/exercises/bob/example.go
trackler-2.0.0.8 tracks/go/exercises/bob/example.go