add single_file_tests
This commit is contained in:
18
single_file_tests/reflect.go
Normal file
18
single_file_tests/reflect.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var x interface{} = "str"
|
||||
|
||||
switch t := x.(type) {
|
||||
case string:
|
||||
fmt.Println("String!")
|
||||
s := x.(string)
|
||||
fmt.Println("As string: " + s)
|
||||
default:
|
||||
fmt.Println("Other: ", t)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user