Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #182 Quine program

Output the source of the current program. A quine is a computer program that takes no input and produces a copy of its own source code as its only output.

Reading the source file from disk is cheating.

package main

import "fmt"

func main() {
	fmt.Printf("%s%c%s%c\n", s, 0x60, s, 0x60)
}

var s = `package main

import "fmt"

func main() {
	fmt.Printf("%s%c%s%c\n", s, 0x60, s, 0x60)
}

var s = `
main(p){printf(p="main(p){printf(p=%c%s%1$c,34,p);}",34,p);}

New implementation...
< >
a