title: How to solve (mismatched types string and byte) in Golang
body: <pre><code>func g(str string) string {
      var i = 0
      var new_str = ""
      for i &lt; len(str) - 1 {
          new_str = new_str + str[i + 1]
          i = i + 1
  }
  
  func f(str string) string {
  if len(str) == 0 {
      return ""
  } else {
      if len(str) == 1 {
          return str
      } else {
          return f(g(str)) + str[0]
      }
  }
  
  func h(n uint64, str string) string {
  for n != 1 {
      if n % 2 == 0 {
          n = n / 2
      } else {
          n = 3*n + 1
      }
      str = f(str)
  }
  return str
  }
  
  
  func pow(x, y uint64) uint64 {
  if y == 0 {
      return 1
  } else {
      return x * pow(x, y-1)
  }
  }
  
  
  func main() {
  fmt.Println(h(1, "fruits"))
  fmt.Println(h(2, "fruits"))
  fmt.Println(h(5, "fruits"))
  fmt.Println(h(pow(2, 1000000000000000), "fruits"))
  fmt.Println(h(pow(2, 1000000000000000), "fruits"))
  }
  </code></pre>
  
  <blockquote>
    <h1>command-line-arguments</h1>
    
    <blockquote>
      <p>.\fruits.go:11:21: invalid operation: new_str + str[i + 1] (mismatched types string and byte)
      .\fruits.go:24:21: invalid operation: f(g(str)) + str[0] (mismatched types string and byte)</p>
    </blockquote>
  </blockquote>