Sign in
go
/
website
/
refs/heads/master
/
.
/
_content
/
tour
/
methods
/
type-assertions.go
blob: dac657f3c83e6b620aa09bcc0128acc3885c67d4 [
file
] [
log
] [
blame
]
//go:build norun || OMIT
package main
import "fmt"
func main() {
var i interface{} = "hello"
s := i.(string)
fmt.Println(s)
s, ok := i.(string)
fmt.Println(s, ok)
f, ok := i.(float64)
fmt.Println(f, ok)
f = i.(float64)
// panic
fmt.Println(f)
}