package main
import("fmt")funcmain(){const name ="tom"
fmt.Println(name)const tax float64=0.8
fmt.Println(tax)}
go run const.go
tom
0.8
package main
import("fmt")funcmain(){const a int
fmt.Println(a)}
go run const.go
# command-line-arguments
./const.go:8:8: missing init exprfor a
package main
import("fmt")funcgetVal(){
fmt.Printf("测试")}funcmain(){const b =9/3
fmt.Println(b)//const c = getVal()//fmt.Println(c)}
go run const.go
3
package main
import("fmt")funcgetVal(){
fmt.Printf("测试")}funcmain(){//const b = 9 / 3//fmt.Println(b)const c =getVal()
fmt.Println(c)}
go run const.go
# command-line-arguments
./const.go:13:12: getVal()(no value) used as value
package main
import("fmt")funcgetVal(){
fmt.Printf("测试")}funcmain(){//const b = 9 / 3//fmt.Println(b)//const c = getVal()//fmt.Println(c)
num :=9const b = num /3
fmt.Println(b)}
go run const.go
# command-line-arguments
./const.go:16:12: num / 3(value of type int) is not constant
常量比较简单的写法
package main
import("fmt")funcgetVal(){
fmt.Printf("测试")}funcmain(){const(
a =1
b =2)
fmt.Println(a, b)const(
c =iota
d
e
)
fmt.Println(c, d, e)}
引言
Kali Linux 是一个基于 Debian 的 Linux 发行版,专门为渗透测试和安全审计而设计。它包含了大量的安全工具,如 Wireshark、Nmap、Metasploit 等,这些工具可以帮助安全专家和研究人员进行网络安全评估、漏洞检测和渗透测试。Kali Linux …