Avatar ·

What is the difference between backticks (``) and double quotes ("") in Go?

Hello everyone! I just started learning Go and noticed that strings can be declared in two ways: using double quotes and using backticks. For example: ```go str1 := "Hello, world!" str2 := `Hello, world!` ``` At first glance, there's no difference — both options work. But I tried to make a multiline string with double quotes and got a compilation error. With backticks, it works fine: ```go // Error! // str3 := "String // on two lines" // Works str4 := `String on two lines` ``` I also noticed that inside double quotes you can use escape sequences like \n, \t, \\, but in backticks they are simply output as text: ```go fmt.Println("String with\nnewline") // Actual newline fmt.Println(`String with\nnewline`) // Prints literally: String with\nnewline ```