mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 02:16:48 +08:00
update book code
This commit is contained in:
16
eBook/exercises/chapter_12/hello_who.go
Executable file
16
eBook/exercises/chapter_12/hello_who.go
Executable file
@@ -0,0 +1,16 @@
|
||||
// hello_who.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
who := "World"
|
||||
if len(os.Args) > 1 { // os.Args[0] == hello_who
|
||||
who = strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
fmt.Println("Hello", who, "!")
|
||||
}
|
Reference in New Issue
Block a user