运算符 | 描述 |
---|---|
&& | 逻辑AND运算符。如果两边操作数都是True,则为True, 否则为False |
|| | 逻辑OR运算符。如果两边的操作数有一个True,则为True,否则为False |
! | 逻辑 NOT运算符。如条件为True,则为False,否则为True |
第一个GO程序
package main
import (
"fmt"
"runtime"
"strconv"
)
func this_is_func() {
var a float32 = 8
var b float32 = 20
var c float32 = b + a
var d float32 = b - a
var e float32 = a * b
var f float32 = a / b
var m int = 8
var n int = 3
var g int = m % n
fmt.Printf("c=%f\n", c)
fmt.Println(d)
fmt.Println(e)
fmt.Println(f)
fmt.Println(g)
}
func rel() {
var a float32 = 8
var b float32 = 3
var c float32 = 5
fmt.Println(!(a > b && b > c)) // True
}
func ops_print() {
fmt.Printf("This OS Orch: %s, Int Size: %d \n", runtime.GOARCH, strconv.IntSize) //This OS Orch: amd64, Int Size: 64
fmt.Printf("260 ==> %b", 260) // 260 ==> 100000100 对应的二进制
}
func main() {
this_is_func()
rel()
ops_print()
}