Variable labels should be meaningful, but you can choose almost any label you like. There are just a few rules and guidelines to be aware of.
There are a few rules when choosing labels:
width of rectanglewould generate an error.
2morrowwill generate errors.
sizeis not the same as
When you see a variable in your program, you'll want to know exactly what's in it without having to search around. Make sure you label your variable something meaningful.
lives are great labels that tell you exactly what that variable is used for.
a are not as helpful.
Labels with multiple words can be easier to read in camelCase. A camelCase label looks like
aReallyLongLabelName. The first letter of the variable name is usually lower case, each new word starts with a capital letter. This helps you see the start of new words without using spaces, which are not allowed in variable names.
Another common way to put multiple words in a variable label is to use underscores between the words. When using underscores, programmers usually don't use capital letters at all. These types of variables look like
The most important thing when you choose how to label your variables is to use a consistent style so it's easy for you to remember the exact spelling and capitalization of your variables.
Found a bug in the documentation? Let us know at email@example.com