x
 
1
// Go has various value types including strings,
2
// integers, floats, booleans, etc. Here are a few
3
// basic examples.
4
5
package main
6
7
import "fmt"
8
9
func main() {
10
11
    // Strings, which can be added together with `+`.
12
    fmt.Println("go" + "lang")
13
14
    // Integers and floats.
15
    fmt.Println("1+1 =", 1+1)
16
    fmt.Println("7.0/3.0 =", 7.0/3.0)
17
18
    // Booleans, with boolean operators as you'd expect.
19
    fmt.Println(true && false)
20
    fmt.Println(true || false)
21
    fmt.Println(!true)
22
}
23
分享