9951 explained code solutions for 126 technologies

golangHow to use range with string

package main

func main() {
  str := "joe"

  for k, v := range str {
    print(k, ":", string(v), ";")
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

for k, v := range str

iterate over str string characters with range and having all chars in v variable and index in k variable


return character from its code