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.1.56 tracks/go/exercises/bob/example.go
trackler-2.2.1.55 tracks/go/exercises/bob/example.go
trackler-2.2.1.54 tracks/go/exercises/bob/example.go
trackler-2.2.1.53 tracks/go/exercises/bob/example.go
trackler-2.2.1.52 tracks/go/exercises/bob/example.go
trackler-2.2.1.51 tracks/go/exercises/bob/example.go
trackler-2.2.1.50 tracks/go/exercises/bob/example.go
trackler-2.2.1.49 tracks/go/exercises/bob/example.go
trackler-2.2.1.48 tracks/go/exercises/bob/example.go
trackler-2.2.1.47 tracks/go/exercises/bob/example.go
trackler-2.2.1.46 tracks/go/exercises/bob/example.go
trackler-2.2.1.45 tracks/go/exercises/bob/example.go
trackler-2.2.1.44 tracks/go/exercises/bob/example.go
trackler-2.2.1.43 tracks/go/exercises/bob/example.go
trackler-2.2.1.42 tracks/go/exercises/bob/example.go
trackler-2.2.1.41 tracks/go/exercises/bob/example.go
trackler-2.2.1.40 tracks/go/exercises/bob/example.go
trackler-2.2.1.39 tracks/go/exercises/bob/example.go
trackler-2.2.1.38 tracks/go/exercises/bob/example.go
trackler-2.2.1.37 tracks/go/exercises/bob/example.go