Skip to content

Commit 466c2bd

Browse files
committedAug 25, 2020
Desr 15
1 parent 6422d74 commit 466c2bd

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
 

‎15_typeless_constants/main.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
7+
/* const x = 5
8+
9+
fmt.Printf("%T, %v\n", x, x) */
10+
11+
/* const x = 3
12+
var y int16 = 12
13+
14+
fmt.Printf("%T, %v\n", x, x)
15+
16+
fmt.Printf("%T, %v\n", y, y)
17+
18+
fmt.Printf("%T, %v\n", x+y, x+y) // int16(x) + y
19+
20+
fmt.Printf("%T, %v\n", x, x) */
21+
22+
/* const x = int16(5.2 + 4.8)
23+
24+
fmt.Printf("%T, %v\n", x, x) */
25+
26+
/* const x = 3
27+
const y = 5.6
28+
29+
fmt.Printf("%T, %v\n", x, x)
30+
31+
fmt.Printf("%T, %v\n", y, y)
32+
33+
fmt.Printf("%T, %v\n", x+y, x+y) */
34+
35+
const x = 3
36+
const y = 5.6
37+
const z = true
38+
const t = "test"
39+
40+
fmt.Printf("%T, %v\n", x, x)
41+
fmt.Printf("%T, %v\n", y, y)
42+
fmt.Printf("%T, %v\n", z, z)
43+
fmt.Printf("%T, %v\n", t, t)
44+
45+
}

0 commit comments

Comments
 (0)
Please sign in to comment.