Other Data Types

Data Types

The rest of the data types

Let’s watch this video to find out more about the other data types besides the string data type.

Click on the + tabs below to see the types and examples of data types we have covered in this lesson:

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.