Standard library / go/types
go/types.Slice.Elem()
Element type. Expected stdout: 'int\n'.
Formal Syntax & Structure
go syntaxgo
func (s *Slice) Elem() TypeReturn Value
Type
Element type.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { t := types.NewSlice(types.Typ[types.Int]); fmt.Println(t.Elem()) }