File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ package main
2+
3+ import "fmt"
4+
5+ /**
6+ * Define constants
7+ * Float, String and iota (incremental)
8+ */
9+ const (
10+ PI = 3.14
11+ LANGUAGE = "Go"
12+
13+ A = iota
14+ B = iota
15+ C = iota
16+ )
17+
18+ /**
19+ * Define constants iota (incremental)
20+ */
21+ const (
22+ P = iota
23+ Q = iota
24+ R = iota
25+ )
26+
27+ /**
28+ * Define constants iota (incremental)
29+ * Here, Y and Z does has type, so Go will assume Y and Z are of type iota from X
30+ */
31+ const (
32+ X = iota
33+ Y
34+ Z
35+ )
36+
37+ func main () {
38+
39+ /**
40+ * OUTPUT: 3.14
41+ */
42+ fmt .Println (PI )
43+
44+ /**
45+ * OUTPUT: Go
46+ */
47+ fmt .Println (LANGUAGE )
48+
49+ /**
50+ * OUTPUT: 2 3 4
51+ */
52+ fmt .Println (A , B , C )
53+
54+ /**
55+ * OUTPUT: 0 1 2
56+ */
57+ fmt .Println (P , Q , R )
58+
59+ /**
60+ * OUTPUT: 0 1 2
61+ */
62+ fmt .Println (X , Y , Z )
63+ }
You can’t perform that action at this time.
0 commit comments