Golang tutorial package constant in tamil | learn golang Go #golangtutorial #coding #interview



Golang tutorial package constant in tamil | learn golang Go #golangtutorial #coding #interview

Golang tutorial package constant in tamil | learn golang Go #golangtutorial #coding #interview

What is package?
A package is a collection of source files in the same directory that are compiled together

Name convention:
packages are given lower case, single-word names
there should be no need for underscores or mixedCaps.

Example:
package mathutils

Constants:
Constants are immutable
Example:
const x int64 = 100
const pi = 2.14

Go doesn’t provide a way to specify that a value calculated at runtime.
For example, the following code will fail to compile with the error x + y (value of type int) is not constant:
Constants can be typed or untyped
x := 5
y := 10
const z = x + y // this won’t compile!