github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/map28c.gno (about)

     1  package main
     2  
     3  type Values map[string][]string
     4  
     5  func (v Values) Set(key, value string) {
     6  	v[key] = []string{value}
     7  }
     8  
     9  func main() {
    10  	value1 := Values{}
    11  
    12  	value1.Set("first", "v1")
    13  	value1.Set("second", "v2")
    14  
    15  	// Index case: v, ok := x[k], x is map.
    16  	_, ok := value1["first"]
    17  
    18  	println(ok)
    19  }
    20  
    21  // Output:
    22  // true