typeover
curriculum

Curriculum Foundations Strings, bytes, runes exercise 2 · mcq

Strings, bytes, runes

TypeScript template literals interpolate values directly into a string. Go has no template literal — but there's a stdlib function that's the canonical translation. Pick the Go form.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Go strings are immutable byte sequences. There are no template literals — fmt.Sprintf does the job. A byte is an alias for uint8; a rune is int32 and represents a Unicode codepoint. When you range over a string, you get runes (codepoints), not bytes. This matters more than it sounds.