Grokking Go
Vote

0% completed

​

Variable Naming Rules

In Go, variable names must follow specific rules to ensure clarity and avoid errors. A well-named variable makes code easier to understand and maintain.

1. Rules for Naming Variables

  • Must start with a letter (such as a-z or A-Z; Go also accepts Unicode letters like é) or an underscore (_).
  • Can contain letters, digits (0-9), and underscores (_).
  • Cannot start with a digit.
  • Cannot use Go's reserved keywords (e.g., func, var, package).
  • Variable names are case-sensitive (name and Name are different).

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content