Skip to content

Commit

Permalink
ninja-level6 solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
abk-code committed Oct 19, 2018
1 parent 240007b commit 0935296
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 21_interfaces/06_exercises/ninja-level6.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import "fmt"

func main() {
solution3()
}

func solution3() {

y := []int{10, 200, 30}
z := []int{10, 200, 300}


defer fmt.Println(foo(y...))
fmt.Println(bar(z))
}

func foo(x ...int) int {

sum := 0
for _, num := range x {
sum += num
}
return sum
}

func bar(x []int) int {
sum := 0
for _, num := range x {
sum += num
}
return sum
}

0 comments on commit 0935296

Please sign in to comment.