Skip to content

Commit f998808

Browse files
Merge pull request #48 from haannnees/constants_beginner
adds constants file for beginner
2 parents ceee329 + 82767b4 commit f998808

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

beginner/constants.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)