Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (22 sloc) 0.57 kb
package go_koans
func aboutEnumeration() {
{
var concatenated string
var total int
strings := []string{"hello", " world", "!"}
for i, v := range strings {
total += i
concatenated += v
}
assert(concatenated == __string__) // for loops have a modern variation
assert(total == __int__) // which offers both a value and an index
}
{
var totalLength int
strings := []string{"hello", " world", "!"}
for _, v := range strings {
totalLength += len(v)
}
assert(totalLength == __int__) // although we may omit either value
}
}
Jump to Line
Something went wrong with that request. Please try again.