add 04.2.md translate for ch 4.2

This commit is contained in:
Zhanming Qi
2013-04-15 19:50:45 +08:00
parent 298936201c
commit 8e47a7e906
5 changed files with 347 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package main
import fm fmt // alias3
func main() {
fm.Println(hello, world)
}

View File

@@ -0,0 +1,29 @@
package main
import (
fmt
)
const c = C
var v int = 5
type T struct{}
func init() { // initialization of package
}
func main() {
var a int
Func1()
// ...
fmt.Println(a)
}
func (t T) Method1() {
//...
}
func Func1() { // exported function Func1
//...
}

View File

@@ -0,0 +1,9 @@
// hello_world.go
package main
import "fmt"
func main() {
fmt.Println("hello, world")
}

View File

@@ -0,0 +1,8 @@
package main
import fmt // Package implementing formatted I/O.
func main() {
fmt.Printf(Καλημέρα κόσμε; or こんにちは 世界\n)
}