Link Search Menu Expand Document

Loop - Printing ASCII

We previously learned how to print the different characters of a string with format printing. Refer to the docmentation for a refresher on the fmt package.

Loop through the numbers 33 through 122, and print them out as numbers and text strings.

Hint: Refer to the ASCII coding scheme to see the decimal and glyph representations.

package main

import (
	"fmt"
)

func main() {
	for i := 33; i < 122; i++ {
		fmt.Printf("%v\t%#U\n", i, i)
	}
}

playground