1. package main
    2. import "fmt"
    3. func main() {
    4. const num1 = 10
    5. fmt.Println("num1常量的值为:", num1)
    6. const num2 = 20
    7. fmt.Println("num2常量的值为:", num2)
    8. }

    常量不需要用:=符号,直接=即可。
    image.png