Created
October 1, 2016 00:07
-
-
Save avnik/45b350d1f81684ec6247c5078688c214 to your computer and use it in GitHub Desktop.
quiz: match or not match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| type Setter interface { | |
| Set() bool | |
| } | |
| func makeSetter() Setter { | |
| return nil | |
| } | |
| func main() { | |
| foo := makeSetter() | |
| if _, ok := foo.(Setter); ok { | |
| print("match") | |
| } else { | |
| print("not match") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment