Go by Example: Values

Go tiene varios tipos de valores, incluidas strings, integers, floats, booleans, etc. A continuación se muestran algunos ejemplos básicos.

package main
import "fmt"
func main() {

Strings, se pueden concatenar con el simbolo+.

    fmt.Println("go" + "lang")

Integers y floats.

    fmt.Println("1+1 =", 1+1)
    fmt.Println("7.0/3.0 =", 7.0/3.0)

Booleans, con operadores booleanos como esperarías

    fmt.Println(true && false)
    fmt.Println(true || false)
    fmt.Println(!true)
}
$ go run values.go
golang
1+1 = 2
7.0/3.0 = 2.3333333333333335
false
true
false

Siguiente ejemplo: Variables.