What is the difference between backticks (``) & double quotes (“”) in golang?

前端 未结 4 1433
我寻月下人不归
我寻月下人不归 2021-02-01 00:16

What is the difference between backticks (``) & double quotes (\"\") in golang?

4条回答
  •  灰色年华
    2021-02-01 01:03

    `` represents an uninterpreted strings and "" is an interpreted string.

    The value of a raw string literal (uninterpreted strings) is the string composed of the uninterpreted (implicitly UTF-8-encoded) characters between the quotes

    Interpreted string literals are character sequences between double quotes, as in "bar". Within the quotes, any character may appear except newline and unescaped double quote.

    PS: italicized words are mine

    https://golang.org/ref/spec#String_literals

提交回复
热议问题