How to use const in Go

1 Answer

0 votes
package main

import "fmt"

const (
    A = 54
    B = 12
    C = 89
    PI = 3.14
)

func main() {
    fmt.Println(A)
    fmt.Println(B)
    fmt.Println(C)
    fmt.Println(PI)
}



/*
run:

54
12
89
3.14

*/

 



answered Sep 20, 2020 by avibootz
...