ASP.NET Basics (part 2): Not My Type - Building Blocks
(Page 2 of 10 )
Let's start with the basics: what's a variable when it's home curled up on the couch?
A variable is the fundamental building block of any programming languages. Think of a variable as a container which can be used to store data; this data is used in different places in your ASP.NET program. A variable can store both numeric and non-numeric data, and the contents of a variable can be altered during program execution. Finally, variables can be compared with each other, and you - the programmer - can write program code that performs specific actions on the basis of this comparison.
Every variable must have a name - this name is used to refer to the variable, to perform operations on it, and to retrieve the data it contains. In C#, a variable name is preceded by a keyword indicating the variable type, and must begin with a letter, optionally followed by more letters and numbers. Variable names are case-sensitive, and reserved keywords cannot be used as variable names. For example, "popeye", "one_two_three" and "bigPirateShip" are all valid variable names, while "byte" and "123" are invalid variable names.
Every language has different types of variables - and ASP.NET and C# display no shortage of choices. C# supports a wide variety of data types, including simple numeric, character, string and Boolean types, and more complex arrays, structures, enumerations, classes and interfaces. Over the course of the next few pages, I'll be looking
Next: A New Assignment >>
More ASP.NET Code Articles
More By Harish Kamath (c) Melonfire