Skip to content
Justice Tech School

Variable Naming Rules

Names start with a letter or underscore and contain letters, digits and underscores. They are case sensitive. A name starting with a capital letter is exported, which means other packages can use it. Use camelCase for local names.

Example
myVar := 1
MyVar := 2
_temp := 3
fmt.Println(myVar, MyVar, _temp)

Result

1 2 3

Exercise

Which kind of name is exported?

A name that starts with a  letter

Quiz Test

Is myVar the same as MyVar?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.