25

is it possible to print back quotes in Go using back quotes : something like this:

package main

import "fmt"

func main() {
    fmt.Println(```) // for example I can do it with double quotes "\""
}
rookie
  • 7,453
  • 13
  • 45
  • 57

3 Answers3

26
package main

import "fmt"

func main() {
    // back ` quote
    fmt.Println((`back ` + "`" + ` quote`))
}

Raw string literals are character sequences between back quotes ``. Within the quotes, any character is legal except back quote. The value of a raw string literal is the string composed of the uninterpreted characters between the quotes; in particular, backslashes have no special meaning and the string may span multiple lines. String literals

peterSO
  • 146,831
  • 29
  • 256
  • 250
1

TLDR

fmt.Println("\x60")

\x: Hex see fmt

6016 9610 1408 matches the character ` grave accent


Go Playground

Carson
  • 3,764
  • 2
  • 23
  • 33
0

You can also do it with single quotes:

package main
import "fmt"

func main() {
   fmt.Printf("%c\n", '`')
}

https://golang.org/pkg/fmt#Printf

Zombo
  • 1
  • 55
  • 342
  • 375