Dec 10, 2014

What are Uses for Variables ?

• Holding unique data for an object instance
• Assigning the value of one variable to another
• Representing values within a mathematical expression
• Printing the values to the screen
• Holding references to other objects

Naming a Variable

• Rules:
• Variable identifiers must start with either an
uppercase or lowercase letter, an underscore (_), or a
dollar sign ($).
• Variable identifiers cannot contain punctuation,
spaces, or dashes.

• Guidelines:
• Begin each variable with a lowercase letter;
subsequent words should be capitalized, such as
myVariable.
• Chose names that are mnemonic and that indicate to
the casual observer the intent of the variable.

0 comments:

Post a Comment