Search This Blog

Friday, 20 July 2012

Variables


A variable can be compared to a storage room, and is essential for the programmer. In C#, a variable is declared like this:

<data type> <name>;

An example could look like this:

string name;

That's the most basic version. Usually, you wish to assign a visibility to the variable, and perhaps assign a value to it at the same time. It can be done like this:

<visibility> <data type> <name> = <value>;

And with an example:
private string name = "John Doe";


Previous Chapter
Next Chapter

No comments:

Post a Comment