Debian Codegraph @

_test/map30.go

raw symbols SCIP
1 package main
2
3 import "strings"
4
5 func f(s string) string { return "hello " + s }
6
7 func g(s string) string { return "hi " + s }
8
9 var methods = map[string]func(string) string{
10 "f": f,
11 "h": strings.ToLower,
12 }
13
14 func main() {
15 methods["i"] = strings.ToUpper
16 methods["g"] = g
17 println(methods["f"]("test"))
18 println(methods["g"]("test"))
19 println(methods["i"]("test"))
20 println(methods["h"]("TEST"))
21 }
22
23 // Output:
24 // hello test
25 // hi test
26 // TEST
27 // test