aboutsummaryrefslogtreecommitdiff
path: root/content/constants/complex1.go
diff options
context:
space:
mode:
Diffstat (limited to 'content/constants/complex1.go')
-rw-r--r--content/constants/complex1.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/content/constants/complex1.go b/content/constants/complex1.go
new file mode 100644
index 0000000..ea45921
--- /dev/null
+++ b/content/constants/complex1.go
@@ -0,0 +1,18 @@
+// +build OMIT
+
+package main
+
+import "fmt"
+
+func main() {
+ // START OMIT
+ type MyComplex128 complex128
+ const I = (0.0 + 1.0i)
+ const TypedI complex128 = (0.0 + 1.0i)
+ var mc MyComplex128
+ mc = (0.0 + 1.0i) // OK
+ mc = I // OK
+ mc = TypedI // Bad
+ fmt.Println(mc)
+ // STOP OMIT
+}