Source file tour/methods/empty-interface.go

     1  //go:build OMIT
     2  
     3  package main
     4  
     5  import "fmt"
     6  
     7  func main() {
     8  	var i interface{}
     9  	describe(i)
    10  
    11  	i = 42
    12  	describe(i)
    13  
    14  	i = "hello"
    15  	describe(i)
    16  }
    17  
    18  func describe(i interface{}) {
    19  	fmt.Printf("(%v, %T)\n", i, i)
    20  }
    21  

View as plain text