mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-09-12 14:42:01 +00:00
good good study, day day up!
This commit is contained in:
24
vendor/gopl.io/ch1/echo2/main.go
generated
vendored
Normal file
24
vendor/gopl.io/ch1/echo2/main.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
|
||||
// See page 6.
|
||||
//!+
|
||||
|
||||
// Echo2 prints its command-line arguments.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s, sep := "", ""
|
||||
for _, arg := range os.Args[1:] {
|
||||
s += sep + arg
|
||||
sep = " "
|
||||
}
|
||||
fmt.Println(s)
|
||||
}
|
||||
|
||||
//!-
|
Reference in New Issue
Block a user