Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

28 lines
492 B

package main
import "fmt"
func main() {
username := "Sir_King_Über"
// Print bytes directly
for i := 0; i < len(username); i++ {
fmt.Print(username[i], " ")
}
fmt.Printf("\n")
// Print bytes converted to string
for i := 0; i < len(username); i++ {
fmt.Print(string(username[i]), " ")
}
fmt.Printf("\n")
// Print bytes converted to runes
runes := []rune(username)
for _, value := range runes {
fmt.Print(string(value), " ")
}
fmt.Printf("\n")
}