Data types

Learning Objective

  • to recognise that there are 3 different data types that the computer understands:
    • numbers
    • logicals
    • character strings

Table of Contents


We now know about variables: to store something in the computer's memory, we need to name it. What type of information can we store? In spoken language we have nouns, verbs, adverbs, etc. In programming we can use numbers, logicals and character strings.


Numbers can be:

  • integers or whole numbers, such as 1, 2, 3
  • doubles with decimal point values, such as 1.25, 3.75
  • complex numbers with imaginary components such as 3 + 2i, 9 + 6i


Logicals, also known as Booleans, have two possible values:

  • TRUE

Logicals are useful when comparing data.

Character strings

Character strings are made up of letters, numbers and special characters and are generally surrounded by quotation marks. Here we have Research and Platforms as two separate character strings: "Research", "Platrforms".

Challenge 1

What data type is each of the following?

A. 2

B. "fig"


D. "2.5"

Challenge solutions

Solution to Challenge 1

A. number

B. character string

C. logical

D. character string (this one is a bit tricky - by placing the number in quotation marks, we have converted it from a number to a character string)

results matching ""

    No results matching ""