Skip to content

Commit 6422d74

Browse files
committed
Ders 14
1 parent 443ad42 commit 6422d74

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

14_constants/main.go

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
7+
/* 5
8+
3.14
9+
"passed"
10+
true */
11+
12+
/* r := 3.0
13+
14+
const pi float64 = 3.14
15+
16+
areaOfCircle := pi * (math.Pow(r, 2))
17+
18+
fmt.Println(areaOfCircle) */
19+
20+
/* const x int = 2
21+
const y float32 = 3.4
22+
const z string = "test"
23+
const t bool = false
24+
25+
fmt.Printf("%T, %v\n", x, x)
26+
fmt.Printf("%T, %v\n", y, y)
27+
fmt.Printf("%T, %v\n", z, z)
28+
fmt.Printf("%T, %v\n", t, t) */
29+
30+
/* const x = 2
31+
32+
//x = 5
33+
// x++
34+
// x = x + 1
35+
36+
fmt.Printf("%T, %v\n", x, x) */
37+
38+
// const ---> compile time
39+
// var ---> run time
40+
41+
// var x = math.Pow(3, 4)
42+
// const x = math.Pow(3, 4)
43+
44+
/* const x = 5
45+
46+
fmt.Printf("%T, %v\n", x, x) */
47+
48+
/* y := 3
49+
50+
const x = y
51+
52+
fmt.Printf("%T, %v\n", y, y)
53+
fmt.Printf("%T, %v\n", x, x) */
54+
55+
/* const x = 1
56+
var y = 3
57+
58+
fmt.Printf("%T, %v\n", x, x)
59+
fmt.Printf("%T, %v\n", y, y)
60+
fmt.Printf("%T, %v\n", x+y, x+y)
61+
*/
62+
63+
const x, y = 3, 5
64+
65+
fmt.Printf("%T, %v\n", x, x)
66+
fmt.Printf("%T, %v\n", y, y)
67+
}

0 commit comments

Comments
 (0)