What are data types?
When we are coding, we are using data in different ways. We might be using some text like "Well done! Level Up" or we might be using numbers like 1 or 100. It is important then that we understand that this variety of data is actually classified into 'data types'.
Data types are extremely important for all computer programming languages, and for us as programmers, because it impacts how well organised and efficient our program can be. So, let’s learn about some common data types: String, Integer (shortened to int), Floating point (shortened to float) and Boolean.
String: A set of characters that can contain text and numbers, as well as spaces and symbols. e.g. "We love to code!" or "I am 14 years old."
Int: Whole numbers e.g. 8, 29, 365
Float: Decimal numbers e.g. 8.3, 29.45, 365.12
Boolean: True or False
Did you know?
Boolean is named after the mathematician George Boole who developed an algebra of logic which is now called Boolean algebra. Boolean algebra is based on two statements- true and false.
Try this out at home with a partner:
What you will need:
- Blank A4 paper or download this PDF
1) Divide an A4 page into 4 categories using a pen and ruler.
2) Give each category a name using the following once: string, int, float, Boolean.
3) Based on our learning in the article above, classify all of the following data types into the categories you have on your page:
4) Check your answers out by opening the PDF file below.
Fantastic! We can now add understanding "data types" to our list of accomplishments and as we progress over the next few lessons, that is going to be very important. For now, watch the below to out your learning into action with our fifth lesson of MakeCode Arcade.
We have covered some new and important coding concepts again with this lesson. An understanding of data types and arrays are really important with coding. Your home challenge involves really trying to understand more about arrays as we will be continuing to use them in our next lesson.
Download the PDF to assess what arrays you might have around you at home in the form of different collections. Then complete the PDF by filling in different pieces of information about what that array (or collection) looks like.