add type assertion example
diff --git a/examples/type_assert_example.go b/examples/type_assert_example.go
new file mode 100644
index 0000000..6db9a9a
--- /dev/null
+++ b/examples/type_assert_example.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "fmt"
+ "github.com/docopt/docopt.go"
+)
+
+func main() {
+ usage := `usage: foo [-x] [-y]`
+
+ arguments, err := docopt.Parse(usage, nil, true, "", false)
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ fmt.Println(arguments)
+
+ var x bool = arguments["-x"].(bool) // type assertion required
+ if x == true {
+ fmt.Println("x is true")
+ }
+
+ y := arguments["-y"] // no type assertion needed
+ if y == true {
+ fmt.Println("y is true")
+ }
+ y2 := arguments["-y"]
+ if y2 == 10 { // this will never be true, a type assertion would have produced a build error
+ fmt.Println("y is 10")
+ }
+}