Grokking Go
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-zorA-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 (
nameandNameare different).
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%