package main
import "fmt"
const (
ExposedConstant = "1" // exposed outside of package
internalConstant = "2" // for use anywhere in package only
)
func main() {
const functionConstant = "3" // usable anywhere in main func
fmt.Println(ExposedConstant, internalConstant, functionConstant)
}
On Tuesday, May 28, 2019 at 7:12:06 AM UTC-5, Ashutosh Baghel wrote:
>
> Hello folks,
>
> I want to declare a few variables constant. But I guess there is nothing
> as "Constant" type in GoLang. How do I achieve this in GoLang?
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/77ac85b1-a1d5-4a00-b0de-08681356f32d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.