• 4 hours
  • Easy

Free online content available in this course.



Got it!

Last updated on 6/15/21

Understand primitive data types

Now that we've looked at how we store data, let's check what we can store! 

Things all computers know

In the last video, we said that variables have a name and a type. In this chapter, we'll explore types a bit further. Types define what you can put in a variable. There are different types we can use. You've actually seen one of them already: objects! These are often referred to as complex types because they're complex! As we saw in part one, they contain a lot of information, which is very useful for programming.

Another one is primitive types. As you've seen, they're very concrete and not as complex as some objects can get. The most common types are:

  • Boolean

  • String

  • Number

  • Null

Let's look a little closer at each one.


You learned the term Boolean in the chapter about conditional operations.  These logical operations expect to receive a true/false value to make their decision.  For example, if you successfully pass this course then you will have a party. 🎈

As you saw previously, the Boolean data type can contain only the values true or false.  This is the only data type the computer can use to make decisions.  Consider each of the following phrases, each of which produce a Boolean value:  

  • Your age is less than 21. 

  • You have more hair than me. 

  • The temperature is less than 90 degrees AND it's Saturday.

Evaluating each one of these sentences will produce either a true or false response.


The string data type is a series of characters. By characters we mean letters or letter-like symbols used to communicate.

The length of a series of characters, or string, can vary in length. In programming, a string is enclosed in apostrophes or quotations.

“Open Classrooms”

'Open Classrooms'


The number data type is used for arithmetic operations.  Numbers can be positive or negative and may contain a decimal point.

  • 42

  • 42.55

  • -18

  • 235642654625464262564265426.65426542642656


You've already seen this one in the last part!  See?  You know so much already!

Try it out for yourself!

Classify the following pieces of data according to their primitive data type:

  • "J Scott Stanlick"

  • 3.145

  • True

  • -42

  • False

  • 'Dave Matthews'

  • This sentence is not a valid data type.  Can you see why?


  • All computers understand the fundamental primitive data types.

  • Boolean can be only true or false.

  • String contains a series of alphanumeric characters.

  • Number is used in arithmetic.

  • Null is the presence of nothing.

Ever considered an OpenClassrooms diploma?
  • Up to 100% of your training program funded
  • Flexible start date
  • Career-focused projects
  • Individual mentoring
Find the training program and funding option that suits you best
Example of certificate of achievement
Example of certificate of achievement