From cf62599c464ee0ac0d16e09dca931ab7e9b92681 Mon Sep 17 00:00:00 2001 From: Igor V Belousov Date: Tue, 8 Jun 2021 14:27:01 +0300 Subject: [PATCH] Chapter 1 - Input args --- ch1/echo1.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ch1/echo1.go diff --git a/ch1/echo1.go b/ch1/echo1.go new file mode 100644 index 0000000..3b0324f --- /dev/null +++ b/ch1/echo1.go @@ -0,0 +1,17 @@ +package main + +import ( + "fmt" + "os" +) + +func main() { + var s, sep string + + for i := 1; i < len(os.Args); i++ { + s += sep + os.Args[i] + sep = "|" + } + + fmt.Println(s) +} \ No newline at end of file