C# series 1.3 : Variables Types - ponda

Breaking

6/06/2017

C# series 1.3 : Variables Types

A Data type defines the information that can be stored in a variable, the size of needed memory and the operations that can be performed with the variable.

For example, To store an integer value ( a whole number ) in a variable, use the int keyword.

int myAge;

The code above declares a variable named myAge of type integer.

A line of code that completes an action is called a statement. Each statement in C# must end with semicolon.

You can assign the value of a variable when you declare it:

int myAge = 18;

or later in your code:

int myAge;
myAge = 18;

Remember that you need to declare the variable before using it.

Next Lesson : C# series 1.4 : Built-in Data Types

No comments:

Post a Comment