github.com/traefik/yaegi@v0.15.1/_test/gen1.go (about) 1 package main 2 3 import "fmt" 4 5 // SumInts adds together the values of m. 6 func SumInts(m map[string]int64) int64 { 7 var s int64 8 for _, v := range m { 9 s += v 10 } 11 return s 12 } 13 14 // SumFloats adds together the values of m. 15 func SumFloats(m map[string]float64) float64 { 16 var s float64 17 for _, v := range m { 18 s += v 19 } 20 return s 21 } 22 23 func main() { 24 // Initialize a map for the integer values 25 ints := map[string]int64{ 26 "first": 34, 27 "second": 12, 28 } 29 30 // Initialize a map for the float values 31 floats := map[string]float64{ 32 "first": 35.98, 33 "second": 26.99, 34 } 35 36 fmt.Printf("Non-Generic Sums: %v and %v\n", 37 SumInts(ints), 38 SumFloats(floats)) 39 }