What is a string literal in Go programming?

A string literals specifies a string constant that is obtained from concatenating a sequence of characters.

There are two types of string literals:

  • Raw string literals: The value of raw string literals are character sequence between back quotes “. Its value is specified as a string literal that composed of the uninterrupted character between quotes.
  • Interpreted string literals: It is shown between double quotes ” “. The value of the literal is specified as text between the double quotes which may not contain newlines.