Data types and Variables:
Welcome to 2nd tutorial of C# programming. In this tutorial, we will learn about common data types in C# programming language and how to use them to create variables which can be later used.
Data can be of different type and size. For example: Age is an integer data. It will always be an integer value whereas weight is a decimal value. Using appropriate data type is necessary, it makes your programs efficient and optimized.
Variables are temporary memory and they store some type of data. For example variable of ‘age’ will store integer data hence it will have integer data type.
To create variables in C#, you do this:
<data type> <variable name> = <value>;
// For creating a variable for age
int age = 20;
Some common data-types in C# are:
Make sure you have Visual Studio or follow this: C# – Lets begin!