MCPcopy Create free account
hub / github.com/derekbanas/Go-Tutorial / main

Function main

cltest.go:9–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7)
8
9func main() {
10 fmt.Println(os.Args)
11 // Get all values after the first index
12 args := os.Args[1:]
13
14 // Create int array from string array
15 var iArgs = []int{}
16 for _, i := range args {
17 val, err := strconv.Atoi(i)
18 if err != nil {
19 panic(err)
20 }
21 iArgs = append(iArgs, val)
22 }
23
24 max := 0
25 for _, val := range iArgs {
26 if val > max {
27 max = val
28 }
29 }
30 fmt.Println("Max Value :", max)
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected