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:
<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:
No comments:
Post a Comment