Go · Stage 1 – Storing Information · Lesson 12 of 64

Naming Rules and Conventions

Choose valid Go names and understand how capitalization affects visibility.

A Go name may contain letters, digits, and underscores, but it cannot begin with a digit. Names are case-sensitive, so score and Score differ.

Go code

userName := "Maya"
fmt.Println(userName)
Line-by-line explanation
  1. userName is valid camelCase.
  2. The short declaration stores a string.
  3. Println uses the exact same capitalization.
Expected output
Maya

The value is displayed successfully.

Use uppercase intentionally for package APIs, not merely for decoration. Inside one function, lowercase names are normal.