Wednesday, October 27, 2010

Representing Words, Numbers, and Values with Variables

From http://msdn.microsoft.com/en-au/library/9kc1d337.aspx

"Variables are an important concept in computer programming. A variable is a letter or name that can store a value. When you create computer programs, you can use variables to store numbers, such as the height of a building, or words, such as a person's name. Simply put, you can use variables to represent any kind of information your program needs.

You might ask, "Why use a variable when I could just use the information instead?" As the name implies, variables can change the value that they represent as the program is running. For example, you might write a program to track the number of pieces of candy you have in a jar on your desk. Because candy is meant to be eaten, the number of pieces of candy in the jar is likely to change over time. Rather than rewriting your program every time that you get a sugar craving, you can represent the number of pieces of candy with a variable that can change over time...." Read More >>

No comments:

Post a Comment