Junior — Middle
Can you explain the concept of a string in programming?
sobes.tech AI
Answer from AI
In programming, a string is a sequence of characters used to store and process textual information. In Go, a string (string) is an immutable sequence of bytes, usually in UTF-8 encoding.
Example of creating and using a string in Go:
package main
import "fmt"
func main() {
var s string = "Hello, world!"
fmt.Println(s)
}
Strings in Go can be concatenated, their length can be obtained, and individual bytes can be accessed, but for working with Unicode characters, it is better to use runes (rune type).