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.0.7 tracks/go/exercises/bob/example.go
trackler-2.0.0.6 tracks/go/exercises/bob/example.go
trackler-2.0.0.5 tracks/go/exercises/bob/example.go
trackler-2.0.0.4 tracks/go/exercises/bob/example.go
trackler-2.0.0.3 tracks/go/exercises/bob/example.go
trackler-2.0.0.2 tracks/go/exercises/bob/example.go
trackler-2.0.0.1 tracks/go/exercises/bob/example.go
trackler-2.0.0.0 tracks/go/exercises/bob/example.go
trackler-1.0.4.1 tracks/go/exercises/bob/example.go
trackler-1.0.4.0 tracks/go/exercises/bob/example.go
trackler-1.0.3.0 tracks/go/exercises/bob/example.go
trackler-1.0.2.1 tracks/go/exercises/bob/example.go
trackler-1.0.2.0 tracks/go/exercises/bob/example.go
trackler-1.0.1.2 tracks/go/exercises/bob/example.go
trackler-1.0.1.1 tracks/go/exercises/bob/example.go
trackler-1.0.1.0 tracks/go/exercises/bob/example.go
trackler-1.0.0.1 tracks/go/exercises/bob/example.go
trackler-1.0.0 tracks/go/exercises/bob/example.go