Essential Go Basic types  Suggest an edit

Strings

String in Go is an immutable sequence of bytes (8-bit byte values)

This is different than languages like Python, C#, Java or Swift where strings are Unicode.

Zero value of a string type is an empty string.

Basic string usage

	var s string // empty string ""
	s1 := "string\nliteral\nwith\tescape characters\n"
	s2 := `raw string literal
which doesnt't recgonize escape characters like \n
`
	fmt.Printf("sum of strings\n'%s'\n", s+s1+s2)
sum of strings
'string
literal
with	escape characters
raw string literal
which doesnt't recgonize escape characters like \n
'

Learn more about strings.

  ↑ ↓ to navigate     ↵ to select     Esc to close