This sub-section features another type of variable you can use, and it is called an Integer. An Integer is basically a way to store a lot of numbers or values that will not go into decimals. Same as the previous variable, we will be declaring and initializing out Integer variable. Once you’re back into your program, go straight into the coding tab of the last console program we created and either clear what you have or just add some more lines.
To declare a integer variable, you will need to type the following code, ‘Int32 iVari;’. What this does is it creates an Int, or an Integer variable, and then names it.
To initialize your int variable, write this line, ‘iVari = 32;’. This takes the name of your variable and gives it a value based on what you want it to be.
To show you an example of this variable in action, make a new line and type this code ‘Int32 adding;’ and on the next line 'adding = iVari + iVari;'.
Then, on a new line, type 'Console.WriteLine(String.Concat(iVari.ToString(), "+", iVari.ToString(), "=", adding.ToString()));' and on the next line add 'Console.ReadLine();'. Don't worry about what this is because you'll find out in a future section. All it's doing is adding the variable values together.
If you open the console program, you'll see that your equation and the answer comes up. That's just one way the Int variable exceeds the others in, Int32 is extremely important in doing calculations.
You have created your first Integer variable. I will be discussing how to use the next type of variable which is like the Integer variable, but you can have a decimal as a value.