Baham's Blog

Above all else, guard your heart.

Go语言--复制你自己

最近在看图灵社区的《Go语言云动力》这本书,其中有一处例子(1.3一章3节),是一段代码如何输出他自己,觉得挺有趣,按着书上的代码,和提醒,就写了这段代码:


/* */
package main

import (
    "fmt"
)

var ()

const ()

func f() {}
func main() {
    fmt.Printf("%s%c%s%c", s, c, s, c)
}

const c = 0x60
const s = `
/* */
package make
import (
    "fmt"
)
var ()
const ()
func f() {}
func main() {
    fmt.Printf("%s%c%s%c", s, c, s, c)
}

const c = 0x60
const s =
`




The Original Link: http://baham.github.io/11_23_goyu-yan-fu-zhi-ni-zi-ji.html
If you want to reprint it, please do under the CC BY-NC-SA 4.0

Comments