From d124851e7fafefafd691f74dff037ab666123cfd Mon Sep 17 00:00:00 2001 From: Igor V Belousov Date: Tue, 8 Jun 2021 14:39:27 +0300 Subject: [PATCH] Chapter 1 - For in range --- ch1/echo2.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ch1/echo2.go diff --git a/ch1/echo2.go b/ch1/echo2.go new file mode 100644 index 0000000..9b343a8 --- /dev/null +++ b/ch1/echo2.go @@ -0,0 +1,18 @@ +// Echo2 выводит аргументы командной строки +package main + +import ( + "fmt" + "os" +) + +func main() { + s, sep := "", "" + + for _, arg := range os.Args[1:] { + s += sep + arg + sep = "|" + } + + fmt.Println(s) +} \ No newline at end of file