Say in your program you need some values that should never be changed. And this is where constant comes into picture.
Let us simplify with the below example.
package main import "fmt" func main() { const x int = 4 x = 15 fmt.Println("The new value of x is :", x) }
So, in the above code we have created a constant 'x' using the 'const' keyword.
Once the value is assigned to 'x', it cannot be changed as it is a constant.
And that is the reason we ended up with the below error message.