What's this C# Programming course all about?
Part 1: Fundamentals of Programming
Part 2: Programming in the real-world

Data types

Let's find out about Data Types

Data types

Let's find out more

Data types specify the type of data that you work with in a programme. The data type defines the size of memory needed to store the data and the kinds of operations that can be performed on the data.

The best way to understand what a data type is – is by looking at examples of data types. 

Click on the tabs below to see the types and examples of data types:

A string variable can be seen as a ‘string’ of characters or a sequence of characters. It can contain many characters, as long as it is surrounded by double quotation marks.

If you were to forget the double quotation marks, you would get an error (shown by the red underline).


Single character:

A char (short for character) can store unicode or single characters like ‘A’. This means that it can store values with only one letter or symbol.


Error message:

When using a char in code, you need to put your value in single quotes, like ‘B’ or ‘d’.

If you were to add more than one character or forget the single quotation marks in a char, you would get an error. 



An int (short for integer) can store both positive and negative numbers.
An integer value takes up the memory space of 4 bytes. It can only store numbers. 


Error message:


If we were to use letters in an int variable, we would get an error. 


A double can store decimal values. It takes up the memory space of 8 bytes. You need to use a full stop (.) to create the decimal and not a comma (,).


Error Message

If we were to use a comma to create our decimal, we would get an error. 


True or False

A bool (short for boolean) can only store values as true or false. This takes up the memory space of 2 bytes. 


Error message

A boolean can only take a true or false value. If we were to use “yes” or “no” as a value, we would get an error. 

Let's watch this video for clarity

Good job – you know about data types now. But that’s just scratching the surface of programming. 

Next up – let’s learn about variables and constants. 

Click here to access the next topic if the “next topic” button isn’t working for you. 

Click here to access next topic - Variables and Constants