Avoid needlessly instantiating return variables!
Instead of:
// Sum each integer in a string of only integers
func countLetterA(input string) int {
v := 0
for _, s := range input {
if s == 'a' {
v++
}
}
return v
Do:
func countLetterA(input string) (v int) {
for _, s := range input {
if s == 'a' {
v++
}
}
return
#golang #tips