An int is a single whole number within C#.

Think of computer memory as a series of boxes. Inside each box can store something with a given ‘type’. When using an ‘int’, we are telling the computer to store a whole number.

Here is an example:

int fred = 23;

By writing ‘int’ we have written that we want that box in memory that contains a whole number (an int) and ‘fred’ is a name or variable for that ‘box’ in memory

Then comes the =, this says we have a box that contains a whole number named fred and the number we want in that box is equal to the number 23. Then the ; to end the line.

To print this onto the console you need to use the following code

Console.WriteLine(fred); 

For more information and explanation on how to print this onto the console see This Post.

Comment any questions below!

Other Basics We Have Covered


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending