Standard library / reflect

reflect.MapIter.Value()

Returns the current map element after a successful Next. Expected stdout: '7\n'.

Formal Syntax & Structure

go syntaxgo
func (iter *MapIter) Value() Value

Return Value

Value

Returns the current map element after a successful Next.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() {  m := reflect.ValueOf(map[string]int{"a": 7})  it := m.MapRange()  it.Next()  fmt.Println(it.Value().Int())}
Go Reference