mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
27 lines
278 B
Go
27 lines
278 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
func f(i interface{}) {
|
|
switch at := i.(type) {
|
|
case int, int8:
|
|
println("integer", at)
|
|
case io.Reader:
|
|
println("reader")
|
|
}
|
|
println("bye")
|
|
}
|
|
|
|
func main() {
|
|
var fd *os.File
|
|
var r io.Reader = fd
|
|
f(r)
|
|
}
|
|
|
|
// Output:
|
|
// reader
|
|
// bye
|