-
Notifications
You must be signed in to change notification settings - Fork 2
/
exercise1.go
38 lines (28 loc) · 916 Bytes
/
exercise1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2014 Ardan Studios
//
// All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// Declare an untyped and typed constant and display their values.
//
// Multiply two literal constants into a typed variable and display the value.
package main
import "fmt"
// Add imports.
const (
// Declare a constant named server of kind string and assign a value.
server string = "localhost"
// Declare a constant named port of type integer and assign a value.
port int = 3000
)
func main() {
// Display the value of both server and port.
fmt.Printf("Listening on %v:%v\n", server, port)
// Divide a constant of kind integer and kind floating point and
// assign the result to a variable.
a := 2 / 1.0
// Display the value of the variable.
fmt.Printf("%v [%T]\n", a, a)
}
// Outputs:
// Listening on localhost:3000
// 2 [float64]