Declaring and Using Variables

A variable is a location in the computer's memory where you can temporarily store information, such as a number or a string.

In a programming language, a string is a sequence of characters and is delimited by double quotes. An example of a string would be

"Hello, World!"

Variables have three components to them:

  • A value, such as 5, or “Hello, World!”

  • A name, which is used to refer to the value of the variable.

  • A type, which indicates what type of values can be stored. For example, a variable whose value is 5 would have the type Integer. A variable whose value is “Hello, World!” would have the type string.

Because a variable's ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.