mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-12-27 15:26:20 +00:00
25 lines
353 B
Go
25 lines
353 B
Go
|
// 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)
|
||
|
}
|
||
|
|
||
|
//!-
|