Ad
  • Custom User Avatar

    You could remove the need to initialize z every time in the for loop of newItem by using an if else inside the for loop.

    for _, r := range name {
        if r >= 'A' && r <= 'Z' {
          rank += int(r) - int('A') + 1
        } else {
          rank += int(r) - int('a') + 1
        }
    }