Learn
Data Types
Introduction to Data Types

Data is a basic unit in programming. Without data, we couldn’t write any programs! But what is data? We may be familiar with data as information, or facts. In computing, data is the pieces of information that we use to build programs, like the numbers in a calculation, or the text printed to a screen.

Data types are exactly what they sound like: different types of data. Data types tell us about the data, including how it can be stored and what types of operations we can perform. For example, we can write a program that squares numbers, but it wouldn’t be able to square a word.

In programming, there’s a special group of data types called primitives. Primitives are the most basic data types, so basic that you can find them in pretty much every programming language. They include:

  • Numbers
  • Strings
  • Boolean values (True or False)

In the following exercises, we’ll dig a little deeper into each primitive data type and what you generally can (and can’t do) with each one.

Instructions

Computers can do different things with different kinds of data. This computer will process data according to the function that you give it. If the function matches the data type, you will get an answer! If it doesn’t, you’ll see an error.

The functions do the following:

  • capitalize: will turn lowercase characters into uppercase characters
  • square: will square a number
  • evaluate: will determine if an input is true or false
Folder Icon

Sign up to start coding

Already have an account?