We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ceee329 + 82767b4 commit f998808Copy full SHA for f998808
beginner/constants.go
@@ -0,0 +1,33 @@
1
+package main
2
+
3
+import "fmt"
4
5
+func main() {
6
+ //simple constants
7
+ const stringConstant = "string"
8
+ const boolConstant = true
9
+ const intConstant = 1234
10
11
+ fmt.Print(stringConstant)
12
+ fmt.Print(boolConstant)
13
+ fmt.Print(intConstant)
14
15
+ //simple constant with type
16
+ const float64Constant float64 = 1234.00
17
18
+ fmt.Print(float64Constant)
19
20
+ //multiple constants
21
+ const color, code = "red", 255
22
23
+ fmt.Print(color)
24
+ fmt.Print(code)
25
26
+ const (
27
+ company string = "Go Experts"
28
+ salary float64 = 50000.0
29
+ )
30
31
+ fmt.Print(company)
32
+ fmt.Print(salary)
33
+}
0 commit comments