Sha256: 9b9149abef2c8824ae73863085694e1f4b316539ebbe4f861fbca68a5eb71bea

Contents?: true

Size: 477 Bytes

Versions: 396

Compression:

Stored size: 477 Bytes

Contents

package counter

import "unicode"

// Incorrect implementation: wrongly counts lines.
type Impl1 struct {
	lines, characters, letters int
}

func (c *Impl1) AddString(s string) {
	for _, char := range s {
		if char == '\n' {
			c.lines++
		} else if unicode.IsLetter(char) {
			c.letters++
		}
		c.characters++
	}
}

func (c Impl1) Lines() int      { return c.lines }
func (c Impl1) Letters() int    { return c.letters }
func (c Impl1) Characters() int { return c.characters }

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.179 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.178 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.177 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.176 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.175 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.174 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.173 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.172 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.171 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.170 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.169 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.167 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.166 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.165 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.164 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.163 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.162 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.161 tracks/go/exercises/counter/impl1.go
trackler-2.2.1.160 tracks/go/exercises/counter/impl1.go