We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 240007b commit 0935296Copy full SHA for 0935296
21_interfaces/06_exercises/ninja-level6.go
@@ -0,0 +1,34 @@
1
+package main
2
+
3
+import "fmt"
4
5
+func main() {
6
+ solution3()
7
+}
8
9
+func solution3() {
10
11
+ y := []int{10, 200, 30}
12
+ z := []int{10, 200, 300}
13
14
15
+ defer fmt.Println(foo(y...))
16
+ fmt.Println(bar(z))
17
18
19
+func foo(x ...int) int {
20
21
+ sum := 0
22
+ for _, num := range x {
23
+ sum += num
24
+ }
25
+ return sum
26
27
28
+func bar(x []int) int {
29
30
31
32
33
34
0 commit comments