Sha256: acdad866abfba9abce8c6f0a112737a35b16572ac736b5cecfc4e14c4f7b869c

Contents?: true

Size: 579 Bytes

Versions: 116

Compression:

Stored size: 579 Bytes

Contents

package bob

import "strings"

const testVersion = 3

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

116 entries across 116 versions & 1 rubygems

Version Path
trackler-2.2.0.3 tracks/go/exercises/bob/example.go
trackler-2.2.0.2 tracks/go/exercises/bob/example.go
trackler-2.2.0.1 tracks/go/exercises/bob/example.go
trackler-2.2.0.0 tracks/go/exercises/bob/example.go
trackler-2.1.0.55 tracks/go/exercises/bob/example.go
trackler-2.1.0.54 tracks/go/exercises/bob/example.go
trackler-2.1.0.53 tracks/go/exercises/bob/example.go
trackler-2.1.0.52 tracks/go/exercises/bob/example.go
trackler-2.1.0.51 tracks/go/exercises/bob/example.go
trackler-2.1.0.50 tracks/go/exercises/bob/example.go
trackler-2.1.0.49 tracks/go/exercises/bob/example.go
trackler-2.1.0.48 tracks/go/exercises/bob/example.go
trackler-2.1.0.47 tracks/go/exercises/bob/example.go
trackler-2.1.0.46 tracks/go/exercises/bob/example.go
trackler-2.1.0.45 tracks/go/exercises/bob/example.go
trackler-2.1.0.44 tracks/go/exercises/bob/example.go
trackler-2.1.0.43 tracks/go/exercises/bob/example.go
trackler-2.1.0.42 tracks/go/exercises/bob/example.go
trackler-2.1.0.41 tracks/go/exercises/bob/example.go
trackler-2.1.0.40 tracks/go/exercises/bob/example.go